histedit: use revset to check if we need to update during abort
authorPierre-Yves David <pierre-yves.david@fb.com>
Mon, 03 Aug 2015 06:08:37 -0700
changeset 25908 5e53d214415d
parent 25907 4b92d11e48fe
child 25909 e62839741aaa
histedit: use revset to check if we need to update during abort The for loop is already quite more complicated than necessary and we are about to add some logic. Instead, we use a simple revset. Revset laziness should provide us with similar performance.
hgext/histedit.py
--- a/hgext/histedit.py	Mon Aug 03 05:57:45 2015 -0700
+++ b/hgext/histedit.py	Mon Aug 03 06:08:37 2015 -0700
@@ -791,11 +791,9 @@
             os.remove(backupfile)
 
         # check whether we should update away
-        parentnodes = [c.node() for c in repo[None].parents()]
-        for n in leafs | set([state.parentctxnode]):
-            if n in parentnodes:
-                hg.clean(repo, state.topmost)
-                break
+        if repo.unfiltered().revs('parents() and (%n  or %ln)',
+                                  state.parentctxnode, leafs):
+            hg.clean(repo, state.topmost)
         cleanupnode(ui, repo, 'created', tmpnodes)
         cleanupnode(ui, repo, 'temp', leafs)
         state.clear()