# HG changeset patch # User Durham Goode # Date 1488426665 28800 # Node ID c22253c4c1b8bdd414f227232499ae323bd2173f # Parent 23080c03a604737b7d32cb789b7526bbec125e08 revert: remove set(mf) because it's O(manifest) The revert code had a 'set(manifest)' line in it, which has a runtime equivalent to the size of the manifest. With alternative manifest implementations, like treemanifest, this can be extra expensive. Let's rewrite it to be O(changes) instead of O(manifest size). diff -r 23080c03a604 -r c22253c4c1b8 mercurial/cmdutil.py --- a/mercurial/cmdutil.py Mon Feb 13 14:05:24 2017 +0100 +++ b/mercurial/cmdutil.py Wed Mar 01 19:51:05 2017 -0800 @@ -2976,11 +2976,11 @@ clean = set(changes.clean) modadded = set() - # split between files known in target manifest and the others - smf = set(mf) - # determine the exact nature of the deleted changesets - deladded = _deleted - smf + deladded = set(_deleted) + for path in _deleted: + if path in mf: + deladded.remove(path) deleted = _deleted - deladded # We need to account for the state of the file in the dirstate, @@ -3024,7 +3024,10 @@ # in case of merge, files that are actually added can be reported as # modified, we need to post process the result if p2 != nullid: - mergeadd = dsmodified - smf + mergeadd = set(dsmodified) + for path in dsmodified: + if path in mf: + mergeadd.remove(path) dsadded |= mergeadd dsmodified -= mergeadd