diff mercurial/changelog.py @ 20185:7d4219512823

branchmap: cache open/closed branch head information This lets us determine the open/closed state of a branch without reading from the changelog (which can be costly over NFS and/or with many branches).
author Brodie Rao <brodie@sf.io>
date Mon, 16 Sep 2013 01:08:29 -0700
parents 8c3dcbbfb5de
children 667df8f478d1
line wrap: on
line diff
--- a/mercurial/changelog.py	Mon Nov 11 21:16:54 2013 +1100
+++ b/mercurial/changelog.py	Mon Sep 16 01:08:29 2013 -0700
@@ -342,9 +342,10 @@
         text = "\n".join(l)
         return self.addrevision(text, transaction, len(self), p1, p2)
 
-    def branch(self, rev):
-        """return the branch of a revision
+    def branchinfo(self, rev):
+        """return the branch name and open/close state of a revision
 
         This function exists because creating a changectx object
         just to access this is costly."""
-        return encoding.tolocal(self.read(rev)[5].get("branch"))
+        extra = self.read(rev)[5]
+        return encoding.tolocal(extra.get("branch")), 'close' in extra