equal
deleted
inserted
replaced
87 self.spath = self.store.path |
87 self.spath = self.store.path |
88 self.sopener = self.store.opener |
88 self.sopener = self.store.opener |
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 |
97 self.nodetagscache = None |
103 self.nodetagscache = None |
98 self.filterpats = {} |
104 self.filterpats = {} |
158 fp.seek(0, 2) |
164 fp.seek(0, 2) |
159 if prevtags and prevtags[-1] != '\n': |
165 if prevtags and prevtags[-1] != '\n': |
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._tagstypecache and name in self._tagstypecache: |
169 if self._tagtypes and name in self._tagtypes: |
164 old = self.tagscache.get(name, nullid) |
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() |
168 |
174 |
169 prevtags = '' |
175 prevtags = '' |
231 self.tags() # instantiate the cache |
237 self.tags() # instantiate the cache |
232 self._tag(names, node, message, local, user, date) |
238 self._tag(names, node, message, local, user, date) |
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.tagscache is None: |
242 if self._tags is None: |
237 (self.tagscache, self._tagstypecache) = self._findtags() |
243 (self._tags, self._tagtypes) = self._findtags() |
238 |
244 |
239 return self.tagscache |
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 |
243 (tags, tagtypes) where tags maps tag name to node, and tagtypes |
249 (tags, tagtypes) where tags maps tag name to node, and tagtypes |
244 maps tag name to a string like \'global\' or \'local\'. |
250 maps tag name to a string like \'global\' or \'local\'. |
351 None : tag does not exist |
357 None : tag does not exist |
352 ''' |
358 ''' |
353 |
359 |
354 self.tags() |
360 self.tags() |
355 |
361 |
356 return self._tagstypecache.get(tagname) |
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''' |
360 l = [] |
366 l = [] |
361 for t, n in self.tags().iteritems(): |
367 for t, n in self.tags().iteritems(): |
689 |
695 |
690 def invalidate(self): |
696 def invalidate(self): |
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.tagscache = None |
700 self._tags = None |
695 self._tagstypecache = None |
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 |
699 self._branchcachetip = None |
705 self._branchcachetip = None |
700 |
706 |