Show More
@@ -273,4 +273,21 b' class sshrepository(repo.repository):' | |||||
273 | def stream_out(self): |
|
273 | def stream_out(self): | |
274 | return self.do_cmd('stream_out') |
|
274 | return self.do_cmd('stream_out') | |
275 |
|
275 | |||
|
276 | def pushkey(self, namespace, key, old, new): | |||
|
277 | if not self.capable('pushkey'): | |||
|
278 | return False | |||
|
279 | d = self.call("pushkey", | |||
|
280 | namespace=namespace, key=key, old=old, new=new) | |||
|
281 | return bool(int(d)) | |||
|
282 | ||||
|
283 | def listkeys(self, namespace): | |||
|
284 | if not self.capable('pushkey'): | |||
|
285 | return {} | |||
|
286 | d = self.call("listkeys", namespace=namespace) | |||
|
287 | r = {} | |||
|
288 | for l in d.splitlines(): | |||
|
289 | k, v = l.split('\t') | |||
|
290 | r[k.decode('string-escape')] = v.decode('string-escape') | |||
|
291 | return r | |||
|
292 | ||||
276 | instance = sshrepository |
|
293 | instance = sshrepository |
@@ -8,12 +8,12 b'' | |||||
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 | |
@@ -223,3 +223,18 b' class sshserver(object):' | |||||
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) |
General Comments 0
You need to be logged in to leave comments.
Login now