diff mercurial/sshrepo.py @ 11369:02a4373ca5cd

pushkey: add ssh support
author Matt Mackall <mpm@selenic.com>
date Wed, 16 Jun 2010 16:05:13 -0500
parents 1765897fc497
children ddaaaa23bb8f
line wrap: on
line diff
--- a/mercurial/sshrepo.py	Wed Jun 16 16:04:46 2010 -0500
+++ b/mercurial/sshrepo.py	Wed Jun 16 16:05:13 2010 -0500
@@ -273,4 +273,21 @@
     def stream_out(self):
         return self.do_cmd('stream_out')
 
+    def pushkey(self, namespace, key, old, new):
+        if not self.capable('pushkey'):
+            return False
+        d = self.call("pushkey",
+                      namespace=namespace, key=key, old=old, new=new)
+        return bool(int(d))
+
+    def listkeys(self, namespace):
+        if not self.capable('pushkey'):
+            return {}
+        d = self.call("listkeys", namespace=namespace)
+        r = {}
+        for l in d.splitlines():
+            k, v = l.split('\t')
+            r[k.decode('string-escape')] = v.decode('string-escape')
+        return r
+
 instance = sshrepository