# HG changeset patch # User Matt Mackall # Date 1285011141 18000 # Node ID 6a6149487817a5b8d4bb081cd36cfda3cdb9760d # Parent 9d234f7d8a7784e1c866dc89b27eb7f6f2170a60 bundle: encapsulate all bundle streams in unbundle class diff -r 9d234f7d8a77 -r 6a6149487817 mercurial/localrepo.py --- 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 diff -r 9d234f7d8a77 -r 6a6149487817 mercurial/sshserver.py --- 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) diff -r 9d234f7d8a77 -r 6a6149487817 mercurial/wireproto.py --- 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