Mercurial > hg-stable
changeset 639:31cebba881a0
Add addchangegroup to the ssh protocol
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Wed, 06 Jul 2005 22:23:57 -0800 |
parents | 35f7adfefa69 |
children | b48b91d3fb4a |
files | mercurial/commands.py mercurial/hg.py |
diffstat | 2 files changed, 24 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/commands.py Wed Jul 06 22:23:27 2005 -0800 +++ b/mercurial/commands.py Wed Jul 06 22:23:57 2005 -0800 @@ -923,6 +923,15 @@ out.flush() + elif cmd == "addchangegroup": + if not lock: + respond("not locked") + continue + respond("") + + r = repo.addchangegroup(fin) + respond("") + def openlog(opt, default): if opts[opt] and opts[opt] != '-': return open(opts[opt], 'w') else: return default
--- a/mercurial/hg.py Wed Jul 06 22:23:27 2005 -0800 +++ b/mercurial/hg.py Wed Jul 06 22:23:57 2005 -0800 @@ -1715,6 +1715,21 @@ f = self.do_cmd("changegroup", roots=n) return self.pipei + def addchangegroup(self, cg): + d = self.call("addchangegroup") + if d: + raise RepoError("push refused: %s", d) + + while 1: + d = cg.read(4096) + if not d: break + self.pipeo.write(d) + + self.pipeo.flush() + + l = int(self.pipei.readline()) + return self.pipei.read(l) + def repository(ui, path=None, create=0): if path: if path.startswith("http://"):