Mercurial > public > mercurial-scm > hg
comparison mercurial/sshrepo.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 | f55869abb5c3 |
children | 4c041f1ee1b4 |
comparison
equal
deleted
inserted
replaced
8562:e3495c399006 | 8563:f8ff65a83169 |
---|---|
6 # GNU General Public License version 2, incorporated herein by reference. | 6 # GNU General Public License version 2, incorporated herein by reference. |
7 | 7 |
8 from node import bin, hex | 8 from node import bin, hex |
9 from i18n import _ | 9 from i18n import _ |
10 import repo, util, error | 10 import repo, util, error |
11 import re | 11 import re, urllib |
12 | 12 |
13 class remotelock(object): | 13 class remotelock(object): |
14 def __init__(self, repo): | 14 def __init__(self, repo): |
15 self.repo = repo | 15 self.repo = repo |
16 def release(self): | 16 def release(self): |
164 try: | 164 try: |
165 return map(bin, d[:-1].split(" ")) | 165 return map(bin, d[:-1].split(" ")) |
166 except: | 166 except: |
167 self.abort(error.ResponseError(_("unexpected response:"), d)) | 167 self.abort(error.ResponseError(_("unexpected response:"), d)) |
168 | 168 |
169 def branchmap(self): | |
170 d = self.call("branchmap") | |
171 try: | |
172 branchmap = {} | |
173 for branchpart in d.splitlines(): | |
174 branchheads = branchpart.split(' ') | |
175 branchname = urllib.unquote(branchheads[0]) | |
176 branchheads = [bin(x) for x in branchheads[1:]] | |
177 branchmap[branchname] = branchheads | |
178 return branchmap | |
179 except: | |
180 raise error.ResponseError(_("unexpected response:"), d) | |
181 | |
169 def branches(self, nodes): | 182 def branches(self, nodes): |
170 n = " ".join(map(hex, nodes)) | 183 n = " ".join(map(hex, nodes)) |
171 d = self.call("branches", nodes=n) | 184 d = self.call("branches", nodes=n) |
172 try: | 185 try: |
173 br = [ tuple(map(bin, b.split(" "))) for b in d.splitlines() ] | 186 br = [ tuple(map(bin, b.split(" "))) for b in d.splitlines() ] |