changeset 1197:8cac667a0d7d stable

prune: work around lazy revset slowdown Since 3.0 lazy revset is making some revset very slow. We currently work around the issue by using a simple loop instead.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Fri, 25 Apr 2014 14:14:29 -0700
parents 79ee85bd899b
children 89c7d96b0ae0
files README hgext/evolve.py
diffstat 2 files changed, 14 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/README
+++ b/README
@@ -62,6 +62,7 @@
 - uncommit: add a --rev argument
 - evolve: add a `working directory now at xxxxxxxxxx` message
 - properly skip marker creating if patch apply cleanly
+- prune: work around a massive slowdown from lazy revset
 
 4.1.0 -- 2014-08-08
 
--- a/hgext/evolve.py
+++ b/hgext/evolve.py
@@ -1870,11 +1870,19 @@
         if bookmark:
             _deletebookmark(ui, marks, bookmark)
         for ctx in repo.unfiltered().set('bookmark() and %ld', precs):
-            ldest = list(repo.set('max((::%d) - obsolete())', ctx))
-            if ldest:
-                dest = ldest[0]
-                updatebookmarks = _bookmarksupdater(repo, ctx.node())
-                updatebookmarks(dest.node())
+            # used to be:
+            #
+            #   ldest = list(repo.set('max((::%d) - obsolete())', ctx))
+            #   if ldest:
+            #      c = ldest[0]
+            #
+            # but then revset took a lazy arrow in the knee and became much
+            # slower. The new forms makes as much sense and a much faster.
+            for dest in ctx.ancestors():
+                if not dest.obsolete():
+                    updatebookmarks = _bookmarksupdater(repo, ctx.node())
+                    updatebookmarks(dest.node())
+                    break
     finally:
         lockmod.release(lock, wlock)