diff mercurial/httprepo.py @ 8563:f8ff65a83169

named branches: client branchmap wire protocol support (issue736) Co-contributor: Sune Foldager <cryo@cyanite.org>
author Henrik Stuart <henrik.stuart@edlund.dk>
date Sat, 23 May 2009 17:03:51 +0200
parents b87a50b7125c
children 4c041f1ee1b4
line wrap: on
line diff
--- a/mercurial/httprepo.py	Sat May 23 17:02:49 2009 +0200
+++ b/mercurial/httprepo.py	Sat May 23 17:03:51 2009 +0200
@@ -145,6 +145,19 @@
         except:
             raise error.ResponseError(_("unexpected response:"), d)
 
+    def branchmap(self):
+        d = self.do_read("branchmap")
+        try:
+            branchmap = {}
+            for branchpart in d.splitlines():
+                branchheads = branchpart.split(' ')
+                branchname = urllib.unquote(branchheads[0])
+                branchheads = [bin(x) for x in branchheads[1:]]
+                branchmap[branchname] = branchheads
+            return branchmap
+        except:
+            raise error.ResponseError(_("unexpected response:"), d)
+
     def branches(self, nodes):
         n = " ".join(map(hex, nodes))
         d = self.do_read("branches", nodes=n)