Show More
@@ -293,14 +293,11 b' def reposetup(ui, repo):' | |||
|
293 | 293 | write(self, marks) |
|
294 | 294 | return result |
|
295 | 295 | |
|
296 | def tags(self): | |
|
296 | def _findtags(self): | |
|
297 | 297 | """Merge bookmarks with normal tags""" |
|
298 | if self.tagscache: | |
|
299 | return self.tagscache | |
|
300 | ||
|
301 | tagscache = super(bookmark_repo, self).tags() | |
|
302 | tagscache.update(parse(self)) | |
|
303 | return tagscache | |
|
298 | (tags, tagtypes) = super(bookmark_repo, self)._findtags() | |
|
299 | tags.update(parse(self)) | |
|
300 | return (tags, tagtypes) | |
|
304 | 301 | |
|
305 | 302 | repo.__class__ = bookmark_repo |
|
306 | 303 |
@@ -2415,34 +2415,33 b' def reposetup(ui, repo):' | |||
|
2415 | 2415 | raise util.Abort(_('source has mq patches applied')) |
|
2416 | 2416 | return super(mqrepo, self).push(remote, force, revs) |
|
2417 | 2417 | |
|
2418 | def tags(self): | |
|
2419 | if self.tagscache: | |
|
2420 |
|
|
|
2421 | ||
|
2422 | tagscache = super(mqrepo, self).tags() | |
|
2418 | def _findtags(self): | |
|
2419 | '''augment tags from base class with patch tags''' | |
|
2420 | result = super(mqrepo, self)._findtags() | |
|
2423 | 2421 | |
|
2424 | 2422 | q = self.mq |
|
2425 | 2423 | if not q.applied: |
|
2426 |
return t |
|
|
2424 | return result | |
|
2427 | 2425 | |
|
2428 | 2426 | mqtags = [(bin(patch.rev), patch.name) for patch in q.applied] |
|
2429 | 2427 | |
|
2430 | 2428 | if mqtags[-1][0] not in self.changelog.nodemap: |
|
2431 | 2429 | self.ui.warn(_('mq status file refers to unknown node %s\n') |
|
2432 | 2430 | % short(mqtags[-1][0])) |
|
2433 |
return t |
|
|
2431 | return result | |
|
2434 | 2432 | |
|
2435 | 2433 | mqtags.append((mqtags[-1][0], 'qtip')) |
|
2436 | 2434 | mqtags.append((mqtags[0][0], 'qbase')) |
|
2437 | 2435 | mqtags.append((self.changelog.parents(mqtags[0][0])[0], 'qparent')) |
|
2436 | tags = result[0] | |
|
2438 | 2437 | for patch in mqtags: |
|
2439 |
if patch[1] in tags |
|
|
2438 | if patch[1] in tags: | |
|
2440 | 2439 | self.ui.warn(_('Tag %s overrides mq patch of the same name\n') |
|
2441 | 2440 | % patch[1]) |
|
2442 | 2441 | else: |
|
2443 |
tags |
|
|
2442 | tags[patch[1]] = patch[0] | |
|
2444 | 2443 | |
|
2445 |
return t |
|
|
2444 | return result | |
|
2446 | 2445 | |
|
2447 | 2446 | def _branchtags(self, partial, lrev): |
|
2448 | 2447 | q = self.mq |
@@ -233,8 +233,24 b' class localrepository(repo.repository):' | |||
|
233 | 233 | |
|
234 | 234 | def tags(self): |
|
235 | 235 | '''return a mapping of tag to node''' |
|
236 | if self.tagscache: | |
|
237 | return self.tagscache | |
|
236 | if self.tagscache is None: | |
|
237 | (self.tagscache, self._tagstypecache) = self._findtags() | |
|
238 | ||
|
239 | return self.tagscache | |
|
240 | ||
|
241 | def _findtags(self): | |
|
242 | '''Do the hard work of finding tags. Return a pair of dicts | |
|
243 | (tags, tagtypes) where tags maps tag name to node, and tagtypes | |
|
244 | maps tag name to a string like \'global\' or \'local\'. | |
|
245 | Subclasses or extensions are free to add their own tags, but | |
|
246 | should be aware that the returned dicts will be retained for the | |
|
247 | duration of the localrepo object.''' | |
|
248 | ||
|
249 | # XXX what tagtype should subclasses/extensions use? Currently | |
|
250 | # mq and bookmarks add tags, but do not set the tagtype at all. | |
|
251 | # Should each extension invent its own tag type? Should there | |
|
252 | # be one tagtype for all such "virtual" tags? Or is the status | |
|
253 | # quo fine? | |
|
238 | 254 | |
|
239 | 255 | globaltags = {} |
|
240 | 256 | tagtypes = {} |
@@ -318,15 +334,13 b' class localrepository(repo.repository):' | |||
|
318 | 334 | except IOError: |
|
319 | 335 | pass |
|
320 | 336 | |
|
321 |
|
|
|
322 | self._tagstypecache = {} | |
|
337 | tags = {} | |
|
323 | 338 | for k, nh in globaltags.iteritems(): |
|
324 | 339 | n = nh[0] |
|
325 | 340 | if n != nullid: |
|
326 |
|
|
|
327 | self._tagstypecache[k] = tagtypes[k] | |
|
328 | self.tagscache['tip'] = self.changelog.tip() | |
|
329 | return self.tagscache | |
|
341 | tags[k] = n | |
|
342 | tags['tip'] = self.changelog.tip() | |
|
343 | return (tags, tagtypes) | |
|
330 | 344 | |
|
331 | 345 | def tagtype(self, tagname): |
|
332 | 346 | ''' |
General Comments 0
You need to be logged in to leave comments.
Login now