# HG changeset patch # User Henrik Stuart # Date 1243091031 -7200 # Node ID f8ff65a8316937d028402b96d0160072804709b5 # Parent e3495c399006ff00658960539e4106b7942a7551 named branches: client branchmap wire protocol support (issue736) Co-contributor: Sune Foldager diff -r e3495c399006 -r f8ff65a83169 mercurial/httprepo.py --- 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) diff -r e3495c399006 -r f8ff65a83169 mercurial/sshrepo.py --- a/mercurial/sshrepo.py Sat May 23 17:02:49 2009 +0200 +++ b/mercurial/sshrepo.py Sat May 23 17:03:51 2009 +0200 @@ -8,7 +8,7 @@ from node import bin, hex from i18n import _ import repo, util, error -import re +import re, urllib class remotelock(object): def __init__(self, repo): @@ -166,6 +166,19 @@ except: self.abort(error.ResponseError(_("unexpected response:"), d)) + def branchmap(self): + d = self.call("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.call("branches", nodes=n)