[PATCH 3 of 5] histedit: use revset to check if we need to update during abort

Pierre-Yves David pierre-yves.david at ens-lyon.org
Mon Aug 3 16:25:25 CDT 2015


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at fb.com>
# Date 1438607317 25200
#      Mon Aug 03 06:08:37 2015 -0700
# Node ID d98266ffb5d74c85409c9fb694bbb78295863801
# Parent  4e57b7b30543c50f009e65c8cf0bf05589bc510b
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.

diff --git a/hgext/histedit.py b/hgext/histedit.py
--- a/hgext/histedit.py
+++ b/hgext/histedit.py
@@ -789,15 +789,13 @@ def _histedit(ui, repo, state, *freeargs
             changegroup.addchangegroup(repo, gen, 'histedit',
                                        'bundle:' + backupfile)
             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()
         return
     else:


More information about the Mercurial-devel mailing list