Show More
@@ -51,7 +51,7 b' def perftags(ui, repo):' | |||||
51 | def t(): |
|
51 | def t(): | |
52 | repo.changelog = mercurial.changelog.changelog(repo.sopener) |
|
52 | repo.changelog = mercurial.changelog.changelog(repo.sopener) | |
53 | repo.manifest = mercurial.manifest.manifest(repo.sopener) |
|
53 | repo.manifest = mercurial.manifest.manifest(repo.sopener) | |
54 |
repo.tags |
|
54 | repo._tags = None | |
55 | return len(repo.tags()) |
|
55 | return len(repo.tags()) | |
56 | timer(t) |
|
56 | timer(t) | |
57 |
|
57 |
@@ -89,8 +89,14 b' class localrepository(repo.repository):' | |||||
89 | self.sjoin = self.store.join |
|
89 | self.sjoin = self.store.join | |
90 | self.opener.createmode = self.store.createmode |
|
90 | self.opener.createmode = self.store.createmode | |
91 |
|
91 | |||
92 | self.tagscache = None |
|
92 | # These two define the set of tags for this repository. _tags | |
93 | self._tagstypecache = None |
|
93 | # maps tag name to node; _tagtypes maps tag name to 'global' or | |
|
94 | # 'local'. (Global tags are defined by .hgtags across all | |||
|
95 | # heads, and local tags are defined in .hg/localtags.) They | |||
|
96 | # constitute the in-memory cache of tags. | |||
|
97 | self._tags = None | |||
|
98 | self._tagtypes = None | |||
|
99 | ||||
94 | self.branchcache = None |
|
100 | self.branchcache = None | |
95 | self._ubranchcache = None # UTF-8 version of branchcache |
|
101 | self._ubranchcache = None # UTF-8 version of branchcache | |
96 | self._branchcachetip = None |
|
102 | self._branchcachetip = None | |
@@ -160,8 +166,8 b' class localrepository(repo.repository):' | |||||
160 | fp.write('\n') |
|
166 | fp.write('\n') | |
161 | for name in names: |
|
167 | for name in names: | |
162 | m = munge and munge(name) or name |
|
168 | m = munge and munge(name) or name | |
163 |
if self._tag |
|
169 | if self._tagtypes and name in self._tagtypes: | |
164 |
old = self.tags |
|
170 | old = self._tags.get(name, nullid) | |
165 | fp.write('%s %s\n' % (hex(old), m)) |
|
171 | fp.write('%s %s\n' % (hex(old), m)) | |
166 | fp.write('%s %s\n' % (hex(node), m)) |
|
172 | fp.write('%s %s\n' % (hex(node), m)) | |
167 | fp.close() |
|
173 | fp.close() | |
@@ -233,10 +239,10 b' class localrepository(repo.repository):' | |||||
233 |
|
239 | |||
234 | def tags(self): |
|
240 | def tags(self): | |
235 | '''return a mapping of tag to node''' |
|
241 | '''return a mapping of tag to node''' | |
236 |
if self.tags |
|
242 | if self._tags is None: | |
237 |
(self.tags |
|
243 | (self._tags, self._tagtypes) = self._findtags() | |
238 |
|
244 | |||
239 |
return self.tags |
|
245 | return self._tags | |
240 |
|
246 | |||
241 | def _findtags(self): |
|
247 | def _findtags(self): | |
242 | '''Do the hard work of finding tags. Return a pair of dicts |
|
248 | '''Do the hard work of finding tags. Return a pair of dicts | |
@@ -353,7 +359,7 b' class localrepository(repo.repository):' | |||||
353 |
|
359 | |||
354 | self.tags() |
|
360 | self.tags() | |
355 |
|
361 | |||
356 |
return self._tag |
|
362 | return self._tagtypes.get(tagname) | |
357 |
|
363 | |||
358 | def tagslist(self): |
|
364 | def tagslist(self): | |
359 | '''return a list of tags ordered by revision''' |
|
365 | '''return a list of tags ordered by revision''' | |
@@ -691,8 +697,8 b' class localrepository(repo.repository):' | |||||
691 | for a in "changelog manifest".split(): |
|
697 | for a in "changelog manifest".split(): | |
692 | if a in self.__dict__: |
|
698 | if a in self.__dict__: | |
693 | delattr(self, a) |
|
699 | delattr(self, a) | |
694 |
self.tags |
|
700 | self._tags = None | |
695 |
self._tag |
|
701 | self._tagtypes = None | |
696 | self.nodetagscache = None |
|
702 | self.nodetagscache = None | |
697 | self.branchcache = None |
|
703 | self.branchcache = None | |
698 | self._ubranchcache = None |
|
704 | self._ubranchcache = None |
@@ -114,7 +114,7 b' class statichttprepository(localrepo.loc' | |||||
114 |
|
114 | |||
115 | self.manifest = manifest.manifest(self.sopener) |
|
115 | self.manifest = manifest.manifest(self.sopener) | |
116 | self.changelog = changelog.changelog(self.sopener) |
|
116 | self.changelog = changelog.changelog(self.sopener) | |
117 |
self.tags |
|
117 | self._tags = None | |
118 | self.nodetagscache = None |
|
118 | self.nodetagscache = None | |
119 | self.encodepats = None |
|
119 | self.encodepats = None | |
120 | self.decodepats = None |
|
120 | self.decodepats = None |
General Comments 0
You need to be logged in to leave comments.
Login now