Comments
Patch
@@ -40,10 +40,12 @@ class pushoperation(object):
# - 0 means HTTP error
# - 1 means we pushed and remote head count is unchanged *or*
# we have outgoing changesets but refused to push
# - other values as described by addchangegroup()
self.ret = None
+ # discover.outgoing object (contains common and outgoin data)
+ self.outgoing = None
def push(repo, remote, force=False, revs=None, newbranch=False):
'''Push outgoing changesets (limited by revs) from a local
repository to remote. Return an integer:
- None means nothing to push
@@ -99,10 +101,11 @@ def push(repo, remote, force=False, revs
commoninc = fci(unfi, pushop.remote, force=pushop.force)
common, inc, remoteheads = commoninc
fco = discovery.findcommonoutgoing
outgoing = fco(unfi, pushop.remote, onlyheads=pushop.revs,
commoninc=commoninc, force=pushop.force)
+ pushop.outgoing = outgoing
if not outgoing.missing:
# nothing to push
scmutil.nochangesfound(unfi.ui, unfi, outgoing.excluded)
@@ -170,14 +173,14 @@ def push(repo, remote, force=False, revs
pushop.ret = pushop.remote.addchangegroup(cg, 'push',
pushop.repo.url())
if pushop.ret:
# push succeed, synchronize target of the push
- cheads = outgoing.missingheads
+ cheads = pushop.outgoing.missingheads
elif pushop.revs is None:
# All out push fails. synchronize all common
- cheads = outgoing.commonheads
+ cheads = pushop.outgoing.commonheads
else:
# I want cheads = heads(::missingheads and ::commonheads)
# (missingheads is revs with secret changeset filtered out)
#
# This can be expressed as:
@@ -189,18 +192,18 @@ def push(repo, remote, force=False, revs
# common = (::commonheads)
# missing = ((commonheads::missingheads) - commonheads)
#
# We can pick:
# * missingheads part of common (::commonheads)
- common = set(outgoing.common)
+ common = set(pushop.outgoing.common)
nm = pushop.repo.changelog.nodemap
cheads = [node for node in pushop.revs if nm[node] in common]
# and
# * commonheads parents on missing
revset = unfi.set('%ln and parents(roots(%ln))',
- outgoing.commonheads,
- outgoing.missing)
+ pushop.outgoing.commonheads,
+ pushop.outgoing.missing)
cheads.extend(c.node() for c in revset)
# even when we don't push, exchanging phase data is useful
remotephases = pushop.remote.listkeys('phases')
if (pushop.ui.configbool('ui', '_usedassubrepo', False)
and remotephases # server supports phases