def branches(self, nodes): n = " ".join(map(hex, nodes)) d = self.do_read("branches", nodes=n) try: br = [tuple(map(bin, b.split(" "))) for b in d.splitlines()] return br except: raise util.UnexpectedOutput(_("unexpected response:"), d)
def between(self, pairs): n = "\n".join(["-".join(map(hex, p)) for p in pairs]) d = self.do_read("between", pairs=n) try: p = [l and map(bin, l.split(" ")) or [] for l in d.splitlines()] return p except: raise util.UnexpectedOutput(_("unexpected response:"), d)
def _recv(self): l = self.pipei.readline() self.readerr() try: l = int(l) except: self.raise_(util.UnexpectedOutput(_("unexpected response:"), l)) return self.pipei.read(l)
def addchangegroup(self, cg, source, url): d = self.call("addchangegroup") if d: self.raise_(repo.RepoError(_("push refused: %s") % d)) while 1: d = cg.read(4096) if not d: break self.pipeo.write(d) self.readerr() self.pipeo.flush() self.readerr() r = self._recv() if not r: return 1 try: return int(r) except: self.raise_(util.UnexpectedOutput(_("unexpected response:"), r))
def unbundle(self, cg, heads, source): d = self.call("unbundle", heads=' '.join(map(hex, heads))) if d: # remote may send "unsynced changes" self.raise_(repo.RepoError(_("push refused: %s") % d)) while 1: d = cg.read(4096) if not d: break self._send(d) self._send("", flush=True) r = self._recv() if r: # remote may send "unsynced changes" self.raise_(repo.RepoError(_("push failed: %s") % r)) r = self._recv() try: return int(r) except: self.raise_(util.UnexpectedOutput(_("unexpected response:"), r))
def heads(self): d = self.do_read("heads") try: return map(bin, d[:-1].split(" ")) except: raise util.UnexpectedOutput(_("unexpected response:"), d)
def heads(self): d = self.call("heads") try: return map(bin, d[:-1].split(" ")) except: self.raise_(util.UnexpectedOutput(_("unexpected response:"), d))