comparison mercurial/sshrepo.py @ 11153:9936ed1d04f4

push: document return values between various repo methods. This starts at localrepository.push() and seeps down to push_addchangegroup(), push_unbundle(), prepush(), addchangegroup(), and leaks out to sshrepository.unbundle(), sshrepository.addchangegroup(), and httprepository.unbundle(). Seems to cover everything you ever wanted to know about pushing but were afraid to ask.
author Greg Ward <greg-hg@gerg.ca>
date Sun, 02 May 2010 21:56:25 -0400
parents 08a0f04b56bd
children 1765897fc497
comparison
equal deleted inserted replaced
11152:e8d10d085f47 11153:9936ed1d04f4
215 bases = " ".join(map(hex, bases)) 215 bases = " ".join(map(hex, bases))
216 heads = " ".join(map(hex, heads)) 216 heads = " ".join(map(hex, heads))
217 return self.do_cmd("changegroupsubset", bases=bases, heads=heads) 217 return self.do_cmd("changegroupsubset", bases=bases, heads=heads)
218 218
219 def unbundle(self, cg, heads, source): 219 def unbundle(self, cg, heads, source):
220 '''Send cg (a readable file-like object representing the
221 changegroup to push, typically a chunkbuffer object) to the
222 remote server as a bundle. Return an integer indicating the
223 result of the push (see localrepository.addchangegroup()).'''
220 d = self.call("unbundle", heads=' '.join(map(hex, heads))) 224 d = self.call("unbundle", heads=' '.join(map(hex, heads)))
221 if d: 225 if d:
222 # remote may send "unsynced changes" 226 # remote may send "unsynced changes"
223 self.abort(error.RepoError(_("push refused: %s") % d)) 227 self.abort(error.RepoError(_("push refused: %s") % d))
224 228
240 return int(r) 244 return int(r)
241 except: 245 except:
242 self.abort(error.ResponseError(_("unexpected response:"), r)) 246 self.abort(error.ResponseError(_("unexpected response:"), r))
243 247
244 def addchangegroup(self, cg, source, url): 248 def addchangegroup(self, cg, source, url):
249 '''Send a changegroup to the remote server. Return an integer
250 similar to unbundle(). DEPRECATED, since it requires locking the
251 remote.'''
245 d = self.call("addchangegroup") 252 d = self.call("addchangegroup")
246 if d: 253 if d:
247 self.abort(error.RepoError(_("push refused: %s") % d)) 254 self.abort(error.RepoError(_("push refused: %s") % d))
248 while 1: 255 while 1:
249 d = cg.read(4096) 256 d = cg.read(4096)