changeset 2423:f328e8aeff8b

merge with upstream
author Benoit Boissinot <benoit.boissinot@ens-lyon.org>
date Sat, 10 Jun 2006 11:28:40 +0200
parents 6aa75e77cafe (current diff) a1cfe679192c (diff)
children 092039246d73
files
diffstat 2 files changed, 27 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/sshrepo.py	Fri Jun 09 12:05:17 2006 -0700
+++ b/mercurial/sshrepo.py	Sat Jun 10 11:28:40 2006 +0200
@@ -37,24 +37,31 @@
         self.pipeo, self.pipei, self.pipee = os.popen3(cmd, 'b')
 
         # skip any noise generated by remote shell
+        self.do_cmd("hello")
         r = self.do_cmd("between", pairs=("%s-%s" % ("0"*40, "0"*40)))
-        l1 = ""
-        l2 = "dummy"
+        lines = ["", "dummy"]
         max_noise = 500
-        while l2 and max_noise:
-            l2 = r.readline()
+        while lines[-1] and max_noise:
+            l = r.readline()
             self.readerr()
-            if l1 == "1\n" and l2 == "\n":
+            if lines[-1] == "1\n" and l == "\n":
                 break
-            if l1:
-                ui.debug(_("remote: "), l1)
-            l1 = l2
+            if l:
+                ui.debug(_("remote: "), l)
+            lines.append(l)
             max_noise -= 1
         else:
             if l1:
                 ui.debug(_("remote: "), l1)
             raise hg.RepoError(_("no response from remote hg"))
 
+        self.capabilities = ()
+        lines.reverse()
+        for l in lines:
+            if l.startswith("capabilities:"):
+                self.capabilities = l[:-1].split(":")[1].split()
+                break
+
     def readerr(self):
         while 1:
             size = util.fstat(self.pipee).st_size
--- a/mercurial/sshserver.py	Fri Jun 09 12:05:17 2006 -0700
+++ b/mercurial/sshserver.py	Sat Jun 10 11:28:40 2006 +0200
@@ -51,6 +51,18 @@
         h = self.repo.heads()
         self.respond(" ".join(map(hex, h)) + "\n")
 
+    def do_hello(self):
+        '''the hello command returns a set of lines describing various
+        interesting things about the server, in an RFC822-like format.
+        Currently the only one defined is "capabilities", which
+        consists of a line in the form:
+
+        capabilities: space separated list of tokens
+        '''
+
+        r = "capabilities:\n"
+        self.respond(r)
+
     def do_lock(self):
         self.lock = self.repo.lock()
         self.respond("")