Mercurial > hg > mercurial-crew-with-dirclash
diff hgext/mq.py @ 3486:fbf8320f25c8
make mq play nicely with the branch cache
- if no patches are applied, don't do anything different
- if the cache includes valid data from one of the patch revisions,
use the cache, but don't save anything new
- if the cache has data from before the patch revisions only,
save what the list of branches would be without the patch revisions
author | Alexis S. L. Carvalho <alexis@cecm.usp.br> |
---|---|
date | Mon, 23 Oct 2006 23:32:56 -0300 |
parents | 0e68608bd11d |
children | 891c8d20f80f 68341c06bc61 |
line wrap: on
line diff
--- a/hgext/mq.py +++ b/hgext/mq.py @@ -2003,6 +2003,35 @@ def reposetup(ui, repo): return tagscache + def branchtags(self): + if self.branchcache != None: + return self.branchcache + + q = self.mq + if not q.applied: + return super(mqrepo, self).branchtags() + + self.branchcache = {} # avoid recursion in changectx + cl = self.changelog + partial, last, lrev = self._readbranchcache() + + qbase = cl.rev(revlog.bin(q.applied[0].rev)) + start = lrev + 1 + if start < qbase: + # update the cache (excluding the patches) and save it + self._updatebranchcache(partial, lrev+1, qbase) + self._writebranchcache(partial, cl.node(qbase-1), qbase-1) + start = qbase + # if start = qbase, the cache is as updated as it should be. + # if start > qbase, the cache includes (part of) the patches. + # we might as well use it, but we won't save it. + + # update the cache up to the tip + self._updatebranchcache(partial, start, cl.count()) + + self.branchcache = partial + return self.branchcache + if repo.local(): repo.__class__ = mqrepo repo.mq = queue(ui, repo.join(""))