Comments
Patch
@@ -64,39 +64,12 @@ class pushoperation(object):
scmutil.nochangesfound(unfi.ui, unfi,
self._outgoing.excluded)
else:
self._ret = self._pushbundle()
- if self._ret:
- # push succeed, synchronize target of the push
- cheads = self._outgoing.missingheads
- elif self.revs is None:
- # All out push fails. synchronize all common
- cheads = self._outgoing.commonheads
- else:
- # I want cheads = heads(::missingheads and ::commonheads)
- # (missingheads is revs with secret changeset filtered out)
- #
- # This can be expressed as:
- # cheads = ( (missingheads and ::commonheads)
- # + (commonheads and ::missingheads))"
- # )
- #
- # while trying to push we already computed the following:
- # common = (::commonheads)
- # missing = ((commonheads::missingheads) - commonheads)
- #
- # We can pick:
- # * missingheads part of common (::commonheads)
- common = set(self._outgoing.common)
- cheads = [node for node in self.revs if node in common]
- # and
- # * commonheads parents on missing
- revset = unfi.set('%ln and parents(roots(%ln))',
- self._outgoing.commonheads,
- self._outgoing.missing)
- cheads.extend(c.node() for c in revset)
+ heads = self._findcommonheads()
+
# even when we don't push, exchanging phase data is useful
remotephases = remote.listkeys('phases')
if (repo.ui.configbool('ui', '_usedassubrepo', False)
and remotephases # server supports phases
and self._ret is None # nothing was pushed
@@ -211,10 +184,42 @@ class pushoperation(object):
else:
# we return an integer indicating remote head count
# change
return self.remote.addchangegroup(cg, 'push', self.repo.url())
+ def _findcommonheads(self):
+ if self._ret:
+ # push succeed, synchronize target of the push
+ cheads = self._outgoing.missingheads
+ elif self.revs is None:
+ # All out push fails. synchronize all common
+ cheads = self._outgoing.commonheads
+ else:
+ # I want cheads = heads(::missingheads and ::commonheads)
+ # (missingheads is revs with secret changeset filtered out)
+ #
+ # This can be expressed as:
+ # cheads = ( (missingheads and ::commonheads)
+ # + (commonheads and ::missingheads))"
+ # )
+ #
+ # while trying to push we already computed the following:
+ # common = (::commonheads)
+ # missing = ((commonheads::missingheads) - commonheads)
+ #
+ # We can pick:
+ # * missingheads part of common (::commonheads)
+ common = set(self._outgoing.common)
+ cheads = [node for node in self.revs if node in common]
+ # and
+ # * commonheads parents on missing
+ unfi = self.repo.unfiltered()
+ revset = unfi.set('%ln and parents(roots(%ln))',
+ self._outgoing.commonheads,
+ self._outgoing.missing)
+ cheads.extend(c.node() for c in revset)
+ return cheads
def _pushobsolescence(self):
"""Send local obsolescence marker to remote"""