rebase: eliminate node from successors early in _computeobsoletenotrebased()
authorDenis Laxalde <denis@laxalde.org>
Fri, 09 Feb 2018 21:45:16 +0100
changeset 35994 ae0d25071fca
parent 35993 a603a570cdbe
child 35995 b7e2cf114e85
rebase: eliminate node from successors early in _computeobsoletenotrebased()
hgext/rebase.py
--- 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