Patchwork [2,of,3] rebase: eliminate node from successors early in _computeobsoletenotrebased()

login
register
mail settings
Submitter Denis Laxalde
Date Feb. 10, 2018, 9:28 a.m.
Message ID <864f2bc67aa90f1ae762.1518254887@marimba>
Download mbox | patch
Permalink /patch/27516/
State Accepted
Headers show

Comments

Denis Laxalde - Feb. 10, 2018, 9:28 a.m.
# HG changeset patch
# User Denis Laxalde <denis@laxalde.org>
# Date 1518209116 -3600
#      Fri Feb 09 21:45:16 2018 +0100
# Node ID 864f2bc67aa90f1ae762206925906950b6258c2f
# Parent  12c15d19266ee99f4d7de6c308286aa5c8a602a6
# EXP-Topic issue5782
rebase: eliminate node from successors early in _computeobsoletenotrebased()

Patch

diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -1798,13 +1798,14 @@  def _computeobsoletenotrebased(repo, reb
         destnode = cl.node(destmap[srcrev])
         # XXX: more advanced APIs are required to handle split correctly
         successors = list(obsutil.allsuccessors(repo.obsstore, [srcnode]))
-        if len(successors) == 1:
-            # obsutil.allsuccessors includes node itself. When the list only
-            # contains one element, it means there are no successors.
+        # obsutil.allsuccessors includes node itself
+        successors.remove(srcnode)
+        if not successors:
+            # no successor
             obsoletenotrebased[srcrev] = None
         else:
             for succnode in successors:
-                if succnode == srcnode or succnode not in nodemap:
+                if succnode not in nodemap:
                     continue
                 if cl.isancestor(succnode, destnode):
                     obsoletenotrebased[srcrev] = nodemap[succnode]
@@ -1813,8 +1814,7 @@  def _computeobsoletenotrebased(repo, reb
                 # If 'srcrev' has a successor in rebase set but none in
                 # destination (which would be catched above), we shall skip it
                 # and its descendants to avoid divergence.
-                if any(nodemap[s] in destmap
-                       for s in successors if s != srcnode):
+                if any(nodemap[s] in destmap for s in successors):
                     obsoletewithoutsuccessorindestination.add(srcrev)
 
     return obsoletenotrebased, obsoletewithoutsuccessorindestination