Comments
Patch
@@ -129,19 +129,15 @@ def push(repo, remote, force=False, revs
unbundle = pushop.remote.capable('unbundle')
if not unbundle:
lock = pushop.remote.lock()
try:
_pushdiscovery(pushop)
- if _pushcheckoutgoing(pushop):
- pushop.repo.prepushoutgoinghooks(pushop.repo,
- pushop.remote,
- pushop.outgoing)
- if (pushop.repo.ui.configbool('experimental', 'bundle2-exp',
- False)
- and pushop.remote.capable('bundle2-exp')):
- _pushbundle2(pushop)
- _pushchangeset(pushop)
+ if (pushop.repo.ui.configbool('experimental', 'bundle2-exp',
+ False)
+ and pushop.remote.capable('bundle2-exp')):
+ _pushbundle2(pushop)
+ _pushchangeset(pushop)
_pushcomputecommonheads(pushop)
_pushsyncphase(pushop)
_pushobsolete(pushop)
finally:
if lock is not None:
@@ -212,10 +208,16 @@ def _pushb2ctx(pushop, bundler):
"""
if 'changesets' in pushop.stepsdone:
return
pushop.stepsdone.add('changesets')
# Send known heads to the server for race detection.
+ pushop.stepsdone.add('changesets')
+ if not _pushcheckoutgoing(pushop):
+ return
+ pushop.repo.prepushoutgoinghooks(pushop.repo,
+ pushop.remote,
+ pushop.outgoing)
if not pushop.force:
bundler.newpart('B2X:CHECK:HEADS', data=iter(pushop.remoteheads))
cg = changegroup.getlocalbundle(pushop.repo, 'push', pushop.outgoing)
cgpart = bundler.newpart('B2X:CHANGEGROUP', data=cg.getchunks())
def handlereply(op):
@@ -235,10 +237,13 @@ def _pushbundle2(pushop):
capsblob = bundle2.encodecaps(pushop.repo.bundle2caps)
bundler.newpart('b2x:replycaps', data=capsblob)
extrainfo = _pushbundle2extraparts(pushop, bundler)
# add the changegroup bundle
cgreplyhandler = _pushb2ctx(pushop, bundler)
+ # do not push if no other parts than the capability
+ if bundler.nbparts <= 1:
+ return
stream = util.chunkbuffer(bundler.getchunks())
try:
reply = pushop.remote.unbundle(stream, ['force'], 'push')
except error.BundleValueError, exc:
raise util.Abort('missing support for %s' % exc)
@@ -266,10 +271,15 @@ def _pushbundle2extrareply(pushop, op, e
def _pushchangeset(pushop):
"""Make the actual push of changeset bundle to remote repo"""
if 'changesets' in pushop.stepsdone:
return
pushop.stepsdone.add('changesets')
+ if not _pushcheckoutgoing(pushop):
+ return
+ pushop.repo.prepushoutgoinghooks(pushop.repo,
+ pushop.remote,
+ pushop.outgoing)
outgoing = pushop.outgoing
unbundle = pushop.remote.capable('unbundle')
# TODO: get bundlecaps from remote
bundlecaps = None
# create a changegroup from local