diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py --- a/mercurial/bundle2.py +++ b/mercurial/bundle2.py @@ -639,7 +639,7 @@ def handlechangegroup(op, inpart): # we need to make sure we trigger the creation of a transaction object used # for the whole processing scope. op.gettransaction() - cg = changegroup.readbundle(inpart, 'bundle2part') + cg = changegroup.unbundle10(inpart, 'UN') ret = changegroup.addchangegroup(op.repo, cg, 'bundle2', 'bundle2') op.records.add('changegroup', {'return': ret}) if op.reply is not None: diff --git a/mercurial/exchange.py b/mercurial/exchange.py --- a/mercurial/exchange.py +++ b/mercurial/exchange.py @@ -109,6 +109,7 @@ def push(repo, remote, force=False, revs if pushop.remote.capable('bundle2'): _pushbundle2(pushop) else: + _pushchangeset(pushop) _pushcomputecommonheads(pushop) _pushsyncphase(pushop) _pushobsolete(pushop) @@ -186,11 +187,7 @@ def _pushbundle2(pushop): bundler.addpart(part) # add the changegroup bundle cg = changegroup.getlocalbundle(pushop.repo, 'push', pushop.outgoing) - def cgchunks(cg=cg): - yield 'HG10UN' - for c in cg.getchunks(): - yield c - cgpart = bundle2.bundlepart('CHANGEGROUP', data=cgchunks()) + cgpart = bundle2.bundlepart('CHANGEGROUP', data=cg.getchunks()) bundler.addpart(cgpart) stream = util.chunkbuffer(bundler.getchunks()) sent = bundle2.unbundle20(pushop.repo.ui, stream) @@ -634,11 +631,7 @@ def getbundle(repo, source, heads=None, # very crude first implementation, # the bundle API will change and the generation will be done lazily. bundler = bundle2.bundle20(repo.ui) - def cgchunks(cg=cg): - yield 'HG10UN' - for c in cg.getchunks(): - yield c - part = bundle2.bundlepart('changegroup', data=cgchunks()) + part = bundle2.bundlepart('changegroup', data=cg.getchunks()) bundler.addpart(part) return bundle2.unbundle20(repo.ui, util.chunkbuffer(bundler.getchunks())) diff --git a/tests/test-bundle2.t b/tests/test-bundle2.t --- a/tests/test-bundle2.t +++ b/tests/test-bundle2.t @@ -67,11 +67,7 @@ Create an extension to test bundle2 API > headcommon = [c.node() for c in repo.set('parents(%ld) - %ld', revs, revs)] > outgoing = discovery.outgoing(repo.changelog, headcommon, headmissing) > cg = changegroup.getlocalbundle(repo, 'test:bundle2', outgoing, None) - > def cgchunks(cg=cg): - > yield 'HG10UN' - > for c in cg.getchunks(): - > yield c - > part = bundle2.bundlepart('changegroup', data=cgchunks()) + > part = bundle2.bundlepart('changegroup', data=cg.getchunks()) > bundler.addpart(part) > > if opts['parts']: @@ -605,7 +601,7 @@ Support for changegroup end of bundle $ cat ../rev.hg2 - HG20\x00\x00\x00\x12\x0bchangegroup\x00\x00\x00\x00\x00\x00\x00\x00\x06\x19HG10UN\x00\x00\x00\xa42\xafv\x86\xd4\x03\xcfE\xb5\xd9_-p\xce\xbe\xa5\x87\xac\x80j_\xdd\xd9\x89W\xc8\xa5JMCm\xfe\x1d\xa9\xd8\x7f!\xa1\xb9{\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x002\xafv\x86\xd4\x03\xcfE\xb5\xd9_-p\xce\xbe\xa5\x87\xac\x80j\x00\x00\x00\x00\x00\x00\x00)\x00\x00\x00)6e1f4c47ecb533ffd0c8e52cdc88afb6cd39e20c (esc) + HG20\x00\x00\x00\x12\x0bchangegroup\x00\x00\x00\x00\x00\x00\x00\x00\x06\x13\x00\x00\x00\xa42\xafv\x86\xd4\x03\xcfE\xb5\xd9_-p\xce\xbe\xa5\x87\xac\x80j_\xdd\xd9\x89W\xc8\xa5JMCm\xfe\x1d\xa9\xd8\x7f!\xa1\xb9{\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x002\xafv\x86\xd4\x03\xcfE\xb5\xd9_-p\xce\xbe\xa5\x87\xac\x80j\x00\x00\x00\x00\x00\x00\x00)\x00\x00\x00)6e1f4c47ecb533ffd0c8e52cdc88afb6cd39e20c (esc) \x00\x00\x00f\x00\x00\x00h\x00\x00\x00\x02D (esc) \x00\x00\x00i\x00\x00\x00j\x00\x00\x00\x01D\x00\x00\x00\xa4\x95 \xee\xa7\x81\xbc\xca\x16\xc1\xe1Z\xcc\x0b\xa1C5\xa0\xe8\xe5\xba\xcd\x01\x0b\x8c\xd9\x98\xf3\x98\x1aZ\x81\x15\xf9O\x8d\xa4\xabP`\x89\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x95 \xee\xa7\x81\xbc\xca\x16\xc1\xe1Z\xcc\x0b\xa1C5\xa0\xe8\xe5\xba\x00\x00\x00\x00\x00\x00\x00)\x00\x00\x00)4dece9c826f69490507b98c6383a3009b295837d (esc) \x00\x00\x00f\x00\x00\x00h\x00\x00\x00\x02E (esc)