Comments
Patch
@@ -571,28 +571,31 @@ def _pullbundle2(pullop):
kwargs = {'bundlecaps': set(['HG2X'])}
capsblob = bundle2.encodecaps(pullop.repo.bundle2caps)
kwargs['bundlecaps'].add('bundle2=' + urllib.quote(capsblob))
# pulling changegroup
pullop.todosteps.remove('changegroup')
+
+ kwargs['common'] = pullop.common
+ kwargs['heads'] = pullop.heads or pullop.rheads
if not pullop.fetch:
pullop.repo.ui.status(_("no changes found\n"))
pullop.cgresult = 0
else:
- kwargs['common'] = pullop.common
- kwargs['heads'] = pullop.heads or pullop.rheads
if pullop.heads is None and list(pullop.common) == [nullid]:
pullop.repo.ui.status(_("requesting all changes\n"))
_pullbundle2extraprepare(pullop, kwargs)
if kwargs.keys() == ['format']:
return # nothing to pull
bundle = pullop.remote.getbundle('pull', **kwargs)
try:
op = bundle2.processbundle(pullop.repo, bundle, pullop.gettransaction)
except bundle2.UnknownPartError, exc:
raise util.Abort('missing support for %s' % exc)
- assert len(op.records['changegroup']) == 1
- pullop.cgresult = op.records['changegroup'][0]['return']
+
+ if pullop.fetch:
+ assert len(op.records['changegroup']) == 1
+ pullop.cgresult = op.records['changegroup'][0]['return']
def _pullbundle2extraprepare(pullop, kwargs):
"""hook function so that extensions can extend the getbundle call"""
pass
@@ -682,11 +685,11 @@ def getbundle(repo, source, heads=None,
have a clearer idea of the API we what to query different data.
The implementation is at a very early stage and will get massive rework
when the API of bundle is refined.
"""
- # build bundle here.
+ # build changegroup bundle here.
cg = changegroup.getbundle(repo, source, heads=heads,
common=common, bundlecaps=bundlecaps)
if bundlecaps is None or 'HG2X' not in bundlecaps:
return cg
# very crude first implementation,
@@ -695,12 +698,13 @@ def getbundle(repo, source, heads=None,
for bcaps in bundlecaps:
if bcaps.startswith('bundle2='):
blob = urllib.unquote(bcaps[len('bundle2='):])
b2caps.update(bundle2.decodecaps(blob))
bundler = bundle2.bundle20(repo.ui, b2caps)
- part = bundle2.bundlepart('b2x:changegroup', data=cg.getchunks())
- bundler.addpart(part)
+ if cg:
+ part = bundle2.bundlepart('b2x:changegroup', data=cg.getchunks())
+ bundler.addpart(part)
_getbundleextrapart(bundler, repo, source, heads=heads, common=common,
bundlecaps=bundlecaps, **kwargs)
return util.chunkbuffer(bundler.getchunks())
def _getbundleextrapart(bundler, repo, source, heads=None, common=None,
@@ -789,10 +789,16 @@ pull
adding manifests
adding file changes
added 1 changesets with 1 changes to 1 files (+1 heads)
(run 'hg heads' to see heads, 'hg merge' to merge)
+pull empty
+
+ $ hg -R other pull -r 24b6387c8c8c
+ pulling from $TESTTMP/main (glob)
+ no changes found
+
push
$ hg -R main push other --rev eea13746799a
pushing to other
searching for changes