diff mercurial/wireproto.py @ 11585:5d907fbb9703

protocol: unify stream_out command
author Matt Mackall <mpm@selenic.com>
date Wed, 14 Jul 2010 16:19:27 -0500
parents 1af96b090116
children ddaaaa23bb8f
line wrap: on
line diff
--- a/mercurial/wireproto.py	Wed Jul 14 15:43:20 2010 -0500
+++ b/mercurial/wireproto.py	Wed Jul 14 16:19:27 2010 -0500
@@ -7,7 +7,7 @@
 
 from i18n import _
 from node import bin, hex
-import urllib
+import urllib, streamclone
 import pushkey as pushkey_
 
 def dispatch(repo, proto, command):
@@ -77,6 +77,12 @@
     r = pushkey_.push(repo, namespace, key, old, new)
     return '%s\n' % int(r)
 
+def stream(repo, proto):
+    try:
+        proto.sendstream(streamclone.stream_out(repo))
+    except streamclone.StreamException, inst:
+        return str(inst)
+
 commands = {
     'between': (between, 'pairs'),
     'branchmap': (branchmap, ''),
@@ -87,4 +93,5 @@
     'listkeys': (listkeys, 'namespace'),
     'lookup': (lookup, 'key'),
     'pushkey': (pushkey, 'namespace key old new'),
+    'stream_out': (stream, ''),
 }