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

mail settings
Submitter Pierre-Yves David
Date Aug. 3, 2015, 9:25 p.m.
Message ID <>
Download mbox | patch
Permalink /patch/10096/
State Accepted
Headers show


Pierre-Yves David - Aug. 3, 2015, 9:25 p.m.
# HG changeset patch
# User Pierre-Yves David <>
# 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/ b/hgext/
--- a/hgext/
+++ b/hgext/
@@ -789,15 +789,13 @@  def _histedit(ui, repo, state, *freeargs
             changegroup.addchangegroup(repo, gen, 'histedit',
                                        'bundle:' + 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)