strip: fix revset usage (issue3604) stable
authorPierre-Yves David <pierre-yves.david@ens-lyon.org>
Fri, 31 Aug 2012 23:27:26 +0200
branchstable
changeset 17410 7c865f30e2b8
parent 17409 1fc45b9a1300
child 17411 a02e36568e88
strip: fix revset usage (issue3604) The `repair` code builds a giant revset query instead of using the "%lr" idiom. It is inefficient and crash when the number of stripped changeset is too big. This changeset replaces the bad code by a better revset usage.
mercurial/repair.py
--- a/mercurial/repair.py	Fri Aug 31 20:40:13 2012 -0500
+++ b/mercurial/repair.py	Fri Aug 31 23:27:26 2012 +0200
@@ -111,9 +111,8 @@
         saverevs.difference_update(descendants)
     savebases = [cl.node(r) for r in saverevs]
     stripbases = [cl.node(r) for r in tostrip]
-    rset = ' or '.join([str(r) for r in tostrip])
-    newbmtarget = repo.revs('sort(heads(ancestors(%r) - (%r)), -rev)',
-                            rset, rset)
+    newbmtarget = repo.revs('sort(heads((::%ld) - (%ld)), -rev)',
+                            tostrip, tostrip)
     if newbmtarget:
         newbmtarget = newbmtarget[0]
     else: