Mercurial > public > mercurial-scm > hg
comparison 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 |
comparison
equal
deleted
inserted
replaced
11584:1af96b090116 | 11585:5d907fbb9703 |
---|---|
5 # This software may be used and distributed according to the terms of the | 5 # This software may be used and distributed according to the terms of the |
6 # GNU General Public License version 2 or any later version. | 6 # GNU General Public License version 2 or any later version. |
7 | 7 |
8 from i18n import _ | 8 from i18n import _ |
9 from node import bin, hex | 9 from node import bin, hex |
10 import urllib | 10 import urllib, streamclone |
11 import pushkey as pushkey_ | 11 import pushkey as pushkey_ |
12 | 12 |
13 def dispatch(repo, proto, command): | 13 def dispatch(repo, proto, command): |
14 if command not in commands: | 14 if command not in commands: |
15 return False | 15 return False |
75 | 75 |
76 def pushkey(repo, proto, namespace, key, old, new): | 76 def pushkey(repo, proto, namespace, key, old, new): |
77 r = pushkey_.push(repo, namespace, key, old, new) | 77 r = pushkey_.push(repo, namespace, key, old, new) |
78 return '%s\n' % int(r) | 78 return '%s\n' % int(r) |
79 | 79 |
80 def stream(repo, proto): | |
81 try: | |
82 proto.sendstream(streamclone.stream_out(repo)) | |
83 except streamclone.StreamException, inst: | |
84 return str(inst) | |
85 | |
80 commands = { | 86 commands = { |
81 'between': (between, 'pairs'), | 87 'between': (between, 'pairs'), |
82 'branchmap': (branchmap, ''), | 88 'branchmap': (branchmap, ''), |
83 'branches': (branches, 'nodes'), | 89 'branches': (branches, 'nodes'), |
84 'changegroup': (changegroup, 'roots'), | 90 'changegroup': (changegroup, 'roots'), |
85 'changegroupsubset': (changegroupsubset, 'bases heads'), | 91 'changegroupsubset': (changegroupsubset, 'bases heads'), |
86 'heads': (heads, ''), | 92 'heads': (heads, ''), |
87 'listkeys': (listkeys, 'namespace'), | 93 'listkeys': (listkeys, 'namespace'), |
88 'lookup': (lookup, 'key'), | 94 'lookup': (lookup, 'key'), |
89 'pushkey': (pushkey, 'namespace key old new'), | 95 'pushkey': (pushkey, 'namespace key old new'), |
96 'stream_out': (stream, ''), | |
90 } | 97 } |