changeset 2028:1f1fc418a96c

ssh: skip noise generated by remote shell we send a dummy command with known output to get in sync
author Matt Mackall <mpm@selenic.com>
date Fri, 31 Mar 2006 03:25:35 -0600
parents 94d3170399e1
children d436b21b20dc
files mercurial/sshrepo.py
diffstat 1 files changed, 10 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/sshrepo.py	Thu Mar 30 19:28:41 2006 -0800
+++ b/mercurial/sshrepo.py	Fri Mar 31 03:25:35 2006 -0600
@@ -36,6 +36,16 @@
         ui.note('running %s\n' % cmd)
         self.pipeo, self.pipei, self.pipee = os.popen3(cmd, 'b')
 
+        # skip any noise generated by remote shell
+        r = self.do_cmd("between", pairs=("%s-%s" % ("0"*40, "0"*40)))
+        l1 = ""
+        while 1:
+            l2 = r.readline()
+            self.readerr()
+            if l1 == "1\n" and l2 == "\n":
+                break
+            l1 = l2
+
     def readerr(self):
         while 1:
             size = os.fstat(self.pipee.fileno())[stat.ST_SIZE]