Mercurial > hg
changeset 22016:7d976d71684c
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.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Tue, 01 Jul 2014 17:27:22 +0200 |
parents | c478031deba2 |
children | 7986e99bb69a |
files | mercurial/exchange.py |
diffstat | 1 files changed, 7 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- 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()