changeset 35994:ae0d25071fca

rebase: eliminate node from successors early in _computeobsoletenotrebased()
author Denis Laxalde <denis@laxalde.org>
date Fri, 09 Feb 2018 21:45:16 +0100
parents a603a570cdbe
children b7e2cf114e85
files hgext/rebase.py
diffstat 1 files changed, 6 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/rebase.py	Wed Feb 07 12:06:13 2018 +0100
+++ b/hgext/rebase.py	Fri Feb 09 21:45:16 2018 +0100
@@ -1798,13 +1798,14 @@
         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 @@
                 # 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