Mercurial > public > mercurial-scm > hg
comparison mercurial/sshserver.py @ 11369:02a4373ca5cd
pushkey: add ssh support
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Wed, 16 Jun 2010 16:05:13 -0500 |
parents | 04e1e6743809 |
children | ee1ed6afac21 |
comparison
equal
deleted
inserted
replaced
11368:b9eb005c54ad | 11369:02a4373ca5cd |
---|---|
6 # This software may be used and distributed according to the terms of the | 6 # This software may be used and distributed according to the terms of the |
7 # GNU General Public License version 2 or any later version. | 7 # GNU General Public License version 2 or any later version. |
8 | 8 |
9 from i18n import _ | 9 from i18n import _ |
10 from node import bin, hex | 10 from node import bin, hex |
11 import streamclone, util, hook | 11 import streamclone, util, hook, pushkey |
12 import os, sys, tempfile, urllib, copy | 12 import os, sys, tempfile, urllib, copy |
13 | 13 |
14 class sshserver(object): | 14 class sshserver(object): |
15 | 15 |
16 caps = 'unbundle lookup changegroupsubset branchmap'.split() | 16 caps = 'unbundle lookup changegroupsubset branchmap pushkey'.split() |
17 | 17 |
18 def __init__(self, ui, repo): | 18 def __init__(self, ui, repo): |
19 self.ui = ui | 19 self.ui = ui |
20 self.repo = repo | 20 self.repo = repo |
21 self.lock = None | 21 self.lock = None |
221 self.fout.write(chunk) | 221 self.fout.write(chunk) |
222 self.fout.flush() | 222 self.fout.flush() |
223 except streamclone.StreamException, inst: | 223 except streamclone.StreamException, inst: |
224 self.fout.write(str(inst)) | 224 self.fout.write(str(inst)) |
225 self.fout.flush() | 225 self.fout.flush() |
226 | |
227 def do_pushkey(self): | |
228 arg, key = self.getarg() | |
229 arg, namespace = self.getarg() | |
230 arg, new = self.getarg() | |
231 arg, old = self.getarg() | |
232 r = pushkey.push(self.repo, namespace, key, old, new) | |
233 self.respond('%s\n' % int(r)) | |
234 | |
235 def do_listkeys(self): | |
236 arg, namespace = self.getarg() | |
237 d = pushkey.list(self.repo, namespace).items() | |
238 t = '\n'.join(['%s\t%s' % (k.encode('string-escape'), | |
239 v.encode('string-escape')) for k, v in d]) | |
240 self.respond(t) |