Mercurial > hg
changeset 9146:5614a628d173
localrepo: rename in-memory tag cache instance attributes (issue548).
- self.tagscache to self._tags
- self._tagstypecache to self._tagtypes
- this is for consistency, readability, privacy, and to subtly hint
that "caching" is something else
author | Greg Ward <greg-hg@gerg.ca> |
---|---|
date | Thu, 16 Jul 2009 10:39:41 -0400 |
parents | 6b03f93b8ff3 |
children | 234a230cc33b |
files | contrib/perf.py mercurial/localrepo.py mercurial/statichttprepo.py |
diffstat | 3 files changed, 18 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/contrib/perf.py Thu Jul 16 10:39:41 2009 -0400 +++ b/contrib/perf.py Thu Jul 16 10:39:41 2009 -0400 @@ -51,7 +51,7 @@ def t(): repo.changelog = mercurial.changelog.changelog(repo.sopener) repo.manifest = mercurial.manifest.manifest(repo.sopener) - repo.tagscache = None + repo._tags = None return len(repo.tags()) timer(t)
--- a/mercurial/localrepo.py Thu Jul 16 10:39:41 2009 -0400 +++ b/mercurial/localrepo.py Thu Jul 16 10:39:41 2009 -0400 @@ -89,8 +89,14 @@ self.sjoin = self.store.join self.opener.createmode = self.store.createmode - self.tagscache = None - self._tagstypecache = None + # These two define the set of tags for this repository. _tags + # maps tag name to node; _tagtypes maps tag name to 'global' or + # 'local'. (Global tags are defined by .hgtags across all + # heads, and local tags are defined in .hg/localtags.) They + # constitute the in-memory cache of tags. + self._tags = None + self._tagtypes = None + self.branchcache = None self._ubranchcache = None # UTF-8 version of branchcache self._branchcachetip = None @@ -160,8 +166,8 @@ fp.write('\n') for name in names: m = munge and munge(name) or name - if self._tagstypecache and name in self._tagstypecache: - old = self.tagscache.get(name, nullid) + if self._tagtypes and name in self._tagtypes: + old = self._tags.get(name, nullid) fp.write('%s %s\n' % (hex(old), m)) fp.write('%s %s\n' % (hex(node), m)) fp.close() @@ -233,10 +239,10 @@ def tags(self): '''return a mapping of tag to node''' - if self.tagscache is None: - (self.tagscache, self._tagstypecache) = self._findtags() + if self._tags is None: + (self._tags, self._tagtypes) = self._findtags() - return self.tagscache + return self._tags def _findtags(self): '''Do the hard work of finding tags. Return a pair of dicts @@ -353,7 +359,7 @@ self.tags() - return self._tagstypecache.get(tagname) + return self._tagtypes.get(tagname) def tagslist(self): '''return a list of tags ordered by revision''' @@ -691,8 +697,8 @@ for a in "changelog manifest".split(): if a in self.__dict__: delattr(self, a) - self.tagscache = None - self._tagstypecache = None + self._tags = None + self._tagtypes = None self.nodetagscache = None self.branchcache = None self._ubranchcache = None
--- a/mercurial/statichttprepo.py Thu Jul 16 10:39:41 2009 -0400 +++ b/mercurial/statichttprepo.py Thu Jul 16 10:39:41 2009 -0400 @@ -114,7 +114,7 @@ self.manifest = manifest.manifest(self.sopener) self.changelog = changelog.changelog(self.sopener) - self.tagscache = None + self._tags = None self.nodetagscache = None self.encodepats = None self.decodepats = None