Mercurial > hg-stable
changeset 12337:6a6149487817
bundle: encapsulate all bundle streams in unbundle class
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Mon, 20 Sep 2010 14:32:21 -0500 |
parents | 9d234f7d8a77 |
children | b016fc1c0862 |
files | mercurial/localrepo.py mercurial/sshserver.py mercurial/wireproto.py |
diffstat | 3 files changed, 9 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/localrepo.py Sun Sep 19 13:12:45 2010 -0500 +++ b/mercurial/localrepo.py Mon Sep 20 14:32:21 2010 -0500 @@ -1543,7 +1543,7 @@ if msng_cl_lst: self.hook('outgoing', node=hex(msng_cl_lst[0]), source=source) - return util.chunkbuffer(gengroup()) + return changegroup.unbundle10(util.chunkbuffer(gengroup()), 'UN') def changegroup(self, basenodes, source): # to avoid a race we use changegroupsubset() (issue1320) @@ -1621,7 +1621,7 @@ if nodes: self.hook('outgoing', node=hex(nodes[0]), source=source) - return util.chunkbuffer(gengroup()) + return changegroup.unbundle10(util.chunkbuffer(gengroup()), 'UN') def addchangegroup(self, source, srctype, url, emptyok=False, lock=None): """Add the changegroup returned by source.read() to this repo. @@ -1644,9 +1644,6 @@ if not source: return 0 - if not hasattr(source, 'chunk'): - source = changegroup.unbundle10(source, 'UN') - self.hook('prechangegroup', throw=True, source=srctype, url=url) changesets = files = revisions = 0
--- a/mercurial/sshserver.py Sun Sep 19 13:12:45 2010 -0500 +++ b/mercurial/sshserver.py Mon Sep 20 14:32:21 2010 -0500 @@ -6,7 +6,7 @@ # This software may be used and distributed according to the terms of the # GNU General Public License version 2 or any later version. -import util, hook, wireproto +import util, hook, wireproto, changegroup import os, sys class sshserver(object): @@ -130,7 +130,8 @@ return self.sendresponse("") - r = self.repo.addchangegroup(self.fin, 'serve', self._client(), + cg = changegroup.unbundle10(self.fin, "UN") + r = self.repo.addchangegroup(cg, 'serve', self._client(), lock=self.lock) return str(r)
--- a/mercurial/wireproto.py Sun Sep 19 13:12:45 2010 -0500 +++ b/mercurial/wireproto.py Mon Sep 20 14:32:21 2010 -0500 @@ -102,14 +102,15 @@ def changegroup(self, nodes, kind): n = encodelist(nodes) f = self._callstream("changegroup", roots=n) - return self._decompress(f) + return changegroupmod.unbundle10(self._decompress(f), 'UN') def changegroupsubset(self, bases, heads, kind): self.requirecap('changegroupsubset', _('look up remote changes')) bases = encodelist(bases) heads = encodelist(heads) - return self._decompress(self._callstream("changegroupsubset", - bases=bases, heads=heads)) + f = self._callstream("changegroupsubset", + bases=bases, heads=heads) + return changegroupmod.unbundle10(self._decompress(f), 'UN') def unbundle(self, cg, heads, source): '''Send cg (a readable file-like object representing the