Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/localrepo.py @ 9151:f528d1a93491
tags: implement persistent tag caching (issue548).
- rename findglobaltags() to findglobaltags1() (so the "no cache"
implementation is still there if we need it)
- add findglobaltags2() and make findglobaltags() an alias for it
(disabling tag caching is a one-line patch)
- factor out tagcache class with methods readcache() and writecache();
the expensive part of tag finding (iterate over heads and find
.hgtags filenode) is now in tagcache.readcache()
author | Greg Ward <greg-hg@gerg.ca> |
---|---|
date | Thu, 16 Jul 2009 10:39:42 -0400 |
parents | 09a1ee498756 |
children | 4017291c4c48 |
comparison
equal
deleted
inserted
replaced
9150:09a1ee498756 | 9151:f528d1a93491 |
---|---|
913 | 913 |
914 def destroyed(self): | 914 def destroyed(self): |
915 '''Inform the repository that nodes have been destroyed. | 915 '''Inform the repository that nodes have been destroyed. |
916 Intended for use by strip and rollback, so there's a common | 916 Intended for use by strip and rollback, so there's a common |
917 place for anything that has to be done after destroying history.''' | 917 place for anything that has to be done after destroying history.''' |
918 # Do nothing for now: this is a placeholder that will be used | |
919 # when we add tag caching. | |
920 # XXX it might be nice if we could take the list of destroyed | 918 # XXX it might be nice if we could take the list of destroyed |
921 # nodes, but I don't see an easy way for rollback() to do that | 919 # nodes, but I don't see an easy way for rollback() to do that |
922 pass | 920 |
921 # Ensure the persistent tag cache is updated. Doing it now | |
922 # means that the tag cache only has to worry about destroyed | |
923 # heads immediately after a strip/rollback. That in turn | |
924 # guarantees that "cachetip == currenttip" (comparing both rev | |
925 # and node) always means no nodes have been added or destroyed. | |
926 | |
927 # XXX this is suboptimal when qrefresh'ing: we strip the current | |
928 # head, refresh the tag cache, then immediately add a new head. | |
929 # But I think doing it this way is necessary for the "instant | |
930 # tag cache retrieval" case to work. | |
931 tags_.findglobaltags(self.ui, self, {}, {}) | |
923 | 932 |
924 def walk(self, match, node=None): | 933 def walk(self, match, node=None): |
925 ''' | 934 ''' |
926 walk recursively through the directory tree or a given | 935 walk recursively through the directory tree or a given |
927 changeset, finding all files matched by the match | 936 changeset, finding all files matched by the match |