Mercurial > public > mercurial-scm > hg-stable
diff 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 |
line wrap: on
line diff
--- a/mercurial/localrepo.py Thu Jul 16 10:39:41 2009 -0400 +++ b/mercurial/localrepo.py Thu Jul 16 10:39:42 2009 -0400 @@ -915,11 +915,20 @@ '''Inform the repository that nodes have been destroyed. Intended for use by strip and rollback, so there's a common place for anything that has to be done after destroying history.''' - # Do nothing for now: this is a placeholder that will be used - # when we add tag caching. # XXX it might be nice if we could take the list of destroyed # nodes, but I don't see an easy way for rollback() to do that - pass + + # Ensure the persistent tag cache is updated. Doing it now + # means that the tag cache only has to worry about destroyed + # heads immediately after a strip/rollback. That in turn + # guarantees that "cachetip == currenttip" (comparing both rev + # and node) always means no nodes have been added or destroyed. + + # XXX this is suboptimal when qrefresh'ing: we strip the current + # head, refresh the tag cache, then immediately add a new head. + # But I think doing it this way is necessary for the "instant + # tag cache retrieval" case to work. + tags_.findglobaltags(self.ui, self, {}, {}) def walk(self, match, node=None): '''