# HG changeset patch # User Benoit Boissinot # Date 1149931720 -7200 # Node ID f328e8aeff8bd0d33b0d57481776aa56cc4a9fdf # Parent 6aa75e77cafeb523a5975559281e6b4441cc76ed# Parent a1cfe679192c7533765c470ce31e9fe1a0ef8091 merge with upstream diff -r 6aa75e77cafe -r f328e8aeff8b mercurial/sshrepo.py --- 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 diff -r 6aa75e77cafe -r f328e8aeff8b mercurial/sshserver.py --- 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("")