hgext/mq.py
changeset 3486 fbf8320f25c8
parent 3468 0e68608bd11d
child 3533 891c8d20f80f
child 3557 68341c06bc61
--- 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(""))