prune: stop reinjecting all selected revisions back into the revrange
authorPierre-Yves David <pierre-yves.david@fb.com>
Mon, 20 Oct 2014 15:59:34 -0700
changeset 1134 7173c70ab2c3
parent 1133 8b3b0549a4b6
child 1135 db16c4ad15d0
prune: stop reinjecting all selected revisions back into the revrange This trigger quadratic complexity for no good reason.
hgext/evolve.py
--- a/hgext/evolve.py	Mon Oct 20 15:53:00 2014 -0700
+++ b/hgext/evolve.py	Mon Oct 20 15:59:34 2014 -0700
@@ -1704,7 +1704,7 @@
     a future release (with the functionality absorbed automatically).
 
     """
-    revs = set(scmutil.revrange(repo, list(revs) + opts.get('rev')))
+    revs = scmutil.revrange(repo, list(revs) + opts.get('rev'))
     succs = opts['new'] + opts['succ']
     bookmark = opts.get('bookmark')
     metadata = _getmetadata(**opts)
@@ -1722,11 +1722,11 @@
     wlock = lock = None
     try:
         wlock = repo.wlock()
-        sortedrevs = lambda specs: sorted(set(scmutil.revrange(repo, specs)))
         lock = repo.lock()
         # defines pruned changesets
         precs = []
-        for p in sortedrevs(revs):
+        revs.sort()
+        for p in revs:
             cp = repo[p]
             if not cp.mutable():
                 # note: createmarkers() would have raised something anyway
@@ -1737,7 +1737,7 @@
             raise util.Abort('nothing to prune')
 
         # defines successors changesets
-        sucs = tuple(repo[n] for n in sortedrevs(succs))
+        sucs = tuple(repo[n] for n in scmutil.revrange(repo, succs))
         if not biject and len(sucs) > 1 and len(precs) > 1:
             msg = "Can't use multiple successors for multiple precursors"
             raise util.Abort(msg)