Mercurial > hg
changeset 30707:987dbe87aad6
repair: combine two loops over changelog revisions
This just saves a few lines.
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Wed, 04 Jan 2017 10:35:04 -0800 |
parents | 2e4862646f02 |
children | 011122b3b1c4 |
files | mercurial/repair.py |
diffstat | 1 files changed, 4 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/repair.py Wed Jan 04 10:07:12 2017 -0800 +++ b/mercurial/repair.py Wed Jan 04 10:35:04 2017 -0800 @@ -91,6 +91,9 @@ striplist = [cl.rev(node) for node in nodelist] striprev = min(striplist) + files = _collectfiles(repo, striprev) + saverevs = _collectbrokencsets(repo, files, striprev) + # Some revisions with rev > striprev may not be descendants of striprev. # We have to find these revisions and put them in a bundle, so that # we can restore them after the truncations. @@ -99,16 +102,11 @@ # (head = revision in the set that has no descendant in the set; # base = revision in the set that has no ancestor in the set) tostrip = set(striplist) + saveheads = set(saverevs) for r in cl.revs(start=striprev + 1): if any(p in tostrip for p in cl.parentrevs(r)): tostrip.add(r) - files = _collectfiles(repo, striprev) - saverevs = _collectbrokencsets(repo, files, striprev) - - # compute heads - saveheads = set(saverevs) - for r in xrange(striprev + 1, len(cl)): if r not in tostrip: saverevs.add(r) saveheads.difference_update(cl.parentrevs(r))