comparison mercurial/sshrepo.py @ 5195:6d5ed61c508c

Fix sshrepo.unbundle We weren't reading all the data sent by the server. Depending on the system, the remote hg (actually, the remote python) could send a "close failed: [Errno 32] Broken pipe", making some tests fail.
author Alexis S. L. Carvalho <alexis@cecm.usp.br>
date Fri, 17 Aug 2007 22:43:38 -0300
parents 6b4127c7d52a
children 86e95b93559a 5a65d870871d
comparison
equal deleted inserted replaced
5194:1843098e665a 5195:6d5ed61c508c
173 return self.do_cmd("changegroupsubset", bases=bases, heads=heads) 173 return self.do_cmd("changegroupsubset", bases=bases, heads=heads)
174 174
175 def unbundle(self, cg, heads, source): 175 def unbundle(self, cg, heads, source):
176 d = self.call("unbundle", heads=' '.join(map(hex, heads))) 176 d = self.call("unbundle", heads=' '.join(map(hex, heads)))
177 if d: 177 if d:
178 # remote may send "unsynced changes"
178 self.raise_(hg.RepoError(_("push refused: %s") % d)) 179 self.raise_(hg.RepoError(_("push refused: %s") % d))
179 180
180 while 1: 181 while 1:
181 d = cg.read(4096) 182 d = cg.read(4096)
182 if not d: break 183 if not d: break
186 187
187 self.pipeo.write('0\n') 188 self.pipeo.write('0\n')
188 self.pipeo.flush() 189 self.pipeo.flush()
189 190
190 self.readerr() 191 self.readerr()
191 d = self.pipei.readline()
192 if d != '\n':
193 return 1
194
195 l = int(self.pipei.readline()) 192 l = int(self.pipei.readline())
196 r = self.pipei.read(l) 193 r = self.pipei.read(l)
197 if not r: 194 if r:
198 return 1 195 # remote may send "unsynced changes"
196 self.raise_(hg.RepoError(_("push failed: %s") % r))
197
198 self.readerr()
199 l = int(self.pipei.readline())
200 r = self.pipei.read(l)
199 return int(r) 201 return int(r)
200 202
201 def addchangegroup(self, cg, source, url): 203 def addchangegroup(self, cg, source, url):
202 d = self.call("addchangegroup") 204 d = self.call("addchangegroup")
203 if d: 205 if d: