Mercurial > hg
changeset 32792:4374e88e808c
checkheads: use a "lazyancestors" object for allfuturecommon
Instead of walking all ancestors to compute the full set we now check membership
lazily. This massively speed.
On a million-ish revision repository, this remove 14 seconds from the push logic,
making the checkheads function disappear from profile.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Mon, 05 Jun 2017 13:44:15 +0100 |
parents | 1cb14923dee9 |
children | 47ca96f9cfca |
files | mercurial/discovery.py |
diffstat | 1 files changed, 3 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/discovery.py Mon Jun 05 13:37:04 2017 +0100 +++ b/mercurial/discovery.py Mon Jun 05 13:44:15 2017 +0100 @@ -248,11 +248,10 @@ # If there are no obsstore, no post processing are needed. if repo.obsstore: - allmissing = set(outgoing.missing) - cctx = repo.set('%ld', outgoing.common) - allfuturecommon = set(c.rev() for c in cctx) torev = repo.changelog.rev - allfuturecommon.update(torev(m) for m in allmissing) + futureheads = set(torev(h) for h in outgoing.missingheads) + futureheads |= set(torev(h) for h in outgoing.commonheads) + allfuturecommon = repo.changelog.ancestors(futureheads, inclusive=True) for branch, heads in sorted(headssum.iteritems()): remoteheads, newheads, unsyncedheads, placeholder = heads result = _postprocessobsolete(pushop, allfuturecommon, newheads)