comparison mercurial/sshrepo.py @ 11591:0d9cb3f3b0a1

protocol: unify client changegroup methods
author Matt Mackall <mpm@selenic.com>
date Wed, 14 Jul 2010 17:09:31 -0500
parents 0b15aee0a306
children 26e0782b8380
comparison
equal deleted inserted replaced
11590:0b15aee0a306 11591:0d9cb3f3b0a1
126 126
127 def _call(self, cmd, **args): 127 def _call(self, cmd, **args):
128 self._callstream(cmd, **args) 128 self._callstream(cmd, **args)
129 return self._recv() 129 return self._recv()
130 130
131 def _decompress(self, stream):
132 return stream
133
131 def _recv(self): 134 def _recv(self):
132 l = self.pipei.readline() 135 l = self.pipei.readline()
133 self.readerr() 136 self.readerr()
134 try: 137 try:
135 l = int(l) 138 l = int(l)
149 self._call("lock") 152 self._call("lock")
150 return remotelock(self) 153 return remotelock(self)
151 154
152 def unlock(self): 155 def unlock(self):
153 self._call("unlock") 156 self._call("unlock")
154
155 def changegroup(self, nodes, kind):
156 n = " ".join(map(hex, nodes))
157 return self._callstream("changegroup", roots=n)
158
159 def changegroupsubset(self, bases, heads, kind):
160 self.requirecap('changegroupsubset', _('look up remote changes'))
161 bases = " ".join(map(hex, bases))
162 heads = " ".join(map(hex, heads))
163 return self._callstream("changegroupsubset", bases=bases, heads=heads)
164 157
165 def unbundle(self, cg, heads, source): 158 def unbundle(self, cg, heads, source):
166 '''Send cg (a readable file-like object representing the 159 '''Send cg (a readable file-like object representing the
167 changegroup to push, typically a chunkbuffer object) to the 160 changegroup to push, typically a chunkbuffer object) to the
168 remote server as a bundle. Return an integer indicating the 161 remote server as a bundle. Return an integer indicating the