# HG changeset patch # User Vadim Gelfer # Date 1150130204 25200 # Node ID fb942bc15ef995655c1dd734665a607435a45a14 # Parent be2fd6398d5018221a07cd84496b291dc32aee10# Parent 092039246d7335342e9a68be90fa625bd3780647 merge with crew. diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -1550,8 +1550,8 @@ class localrepository(object): newheads = len(self.changelog.heads()) heads = "" - if oldheads and newheads > oldheads: - heads = _(" (+%d heads)") % (newheads - oldheads) + if oldheads and newheads != oldheads: + heads = _(" (%+d heads)") % (newheads - oldheads) self.ui.status(_("added %d changesets" " with %d changes to %d files%s\n") diff --git a/mercurial/sshrepo.py b/mercurial/sshrepo.py --- a/mercurial/sshrepo.py +++ b/mercurial/sshrepo.py @@ -37,24 +37,31 @@ class sshrepository(remoterepository): 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 --git a/mercurial/sshserver.py b/mercurial/sshserver.py --- a/mercurial/sshserver.py +++ b/mercurial/sshserver.py @@ -51,6 +51,18 @@ class sshserver(object): 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("") diff --git a/tests/test-push-warn.out b/tests/test-push-warn.out --- a/tests/test-push-warn.out +++ b/tests/test-push-warn.out @@ -47,4 +47,4 @@ searching for changes adding changesets adding manifests adding file changes -added 1 changesets with 1 changes to 1 files +added 1 changesets with 1 changes to 1 files (-1 heads)