hgext/evolve.py
branchstable
changeset 1101 8cac667a0d7d
parent 1099 bac4e0bc9f6a
child 1104 cb36a4eb0157
--- a/hgext/evolve.py	Tue Sep 02 19:19:17 2014 +0200
+++ b/hgext/evolve.py	Fri Apr 25 14:14:29 2014 -0700
@@ -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)