# HG changeset patch # User Pierre-Yves David # Date 1404228442 -7200 # Node ID 7d976d71684c6d03bd348ca72607caca40ad3ca7 # Parent c478031deba2c40c9357f39a7b16d3ae66720560 push: move common heads computation into pushop Now that both options (push succeed or fall back) live in pushop, we can move the common heads computation there too. It is a very commonly accessed attribute so it makes a lot of sense to have it in pushop. diff -r c478031deba2 -r 7d976d71684c mercurial/exchange.py --- a/mercurial/exchange.py Tue Jul 01 17:20:47 2014 +0200 +++ b/mercurial/exchange.py Tue Jul 01 17:27:22 2014 +0200 @@ -77,8 +77,6 @@ self.remoteheads = None # testable as a boolean indicating if any nodes are missing locally. self.incoming = None - # set of all heads common after changeset bundle push - self.commonheads = None @util.propertycache def futureheads(self): @@ -117,6 +115,13 @@ cheads.extend(c.node() for c in revset) return cheads + @property + def commonheads(self): + """set of all common heads after changeset bundle push""" + if self.ret: + return self.futureheads + else: + return self.fallbackheads def push(repo, remote, force=False, revs=None, newbranch=False): '''Push outgoing changesets (limited by revs) from a local @@ -174,7 +179,6 @@ and pushop.remote.capable('bundle2-exp')): _pushbundle2(pushop) _pushchangeset(pushop) - _pushcomputecommonheads(pushop) _pushsyncphase(pushop) _pushobsolete(pushop) finally: @@ -345,13 +349,6 @@ # change pushop.ret = pushop.remote.addchangegroup(cg, 'push', pushop.repo.url()) -def _pushcomputecommonheads(pushop): - if pushop.ret: - cheads = pushop.futureheads - else: - cheads = pushop.fallbackheads - pushop.commonheads = cheads - def _pushsyncphase(pushop): """synchronise phase information locally and remotely""" unfi = pushop.repo.unfiltered()