mercurial/wireproto.py
changeset 11592 26e0782b8380
parent 11591 0d9cb3f3b0a1
child 11593 d054cc5c7737
--- a/mercurial/wireproto.py	Wed Jul 14 17:09:31 2010 -0500
+++ b/mercurial/wireproto.py	Wed Jul 14 17:12:18 2010 -0500
@@ -103,6 +103,26 @@
         return self._decompress(self._callstream("changegroupsubset",
                                                  bases=bases, heads=heads))
 
+    def unbundle(self, cg, heads, source):
+        '''Send cg (a readable file-like object representing the
+        changegroup to push, typically a chunkbuffer object) to the
+        remote server as a bundle. Return an integer indicating the
+        result of the push (see localrepository.addchangegroup()).'''
+
+        ret, output = self._callpush("unbundle", cg, heads=' '.join(map(hex, heads)))
+        if ret == "":
+            raise error.ResponseError(
+                _('push failed:'), output)
+        try:
+            ret = int(ret)
+        except ValueError, err:
+            raise error.ResponseError(
+                _('push failed (unexpected response):'), ret)
+
+        for l in output.splitlines(True):
+            self.ui.status(_('remote: '), l)
+        return ret
+
 # server side
 
 def dispatch(repo, proto, command):