# HG changeset patch # User Boris Feld # Date 1511066090 -3600 # Node ID 5cd6682b5a90f0bc096507b6010c442c89673840 # Parent 82680919d75e46d1cd936da3e98a6f8b3e76c15b 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 diff -r 82680919d75e -r 5cd6682b5a90 mercurial/obsolete.py --- 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