Mercurial > hg-stable
changeset 35158:5cd6682b5a90
obsolete: drop usage of changectx in '_computecontentdivergentset'
Changectx are expensive and not needed there. The use of `repo.set` denote old
code that predate the introduction of `repo.revs` that we now use.
On my mercurial repository 495 draft:
before: 0.054239 second
after: 0.046935 second
On a mercurial repository with 115973 draft:
before: 0.564548 second
after: 0.130534 second
author | Boris Feld <boris.feld@octobus.net> |
---|---|
date | Sun, 19 Nov 2017 05:34:50 +0100 |
parents | 82680919d75e |
children | e397f8585953 |
files | mercurial/obsolete.py |
diffstat | 1 files changed, 5 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/obsolete.py Sun Nov 19 05:23:12 2017 +0100 +++ b/mercurial/obsolete.py Sun Nov 19 05:34:50 2017 +0100 @@ -1023,8 +1023,10 @@ divergent = set() obsstore = repo.obsstore newermap = {} - for ctx in repo.set('(not public()) - obsolete()'): - mark = obsstore.predecessors.get(ctx.node(), ()) + tonode = repo.changelog.node + for rev in repo.revs('(not public()) - obsolete()'): + node = tonode(rev) + mark = obsstore.predecessors.get(node, ()) toprocess = set(mark) seen = set() while toprocess: @@ -1036,7 +1038,7 @@ obsutil.successorssets(repo, prec, cache=newermap) newer = [n for n in newermap[prec] if n] if len(newer) > 1: - divergent.add(ctx.rev()) + divergent.add(rev) break toprocess.update(obsstore.predecessors.get(prec, ())) return divergent