evolve: remove the unnecessary condition to check empty successors set
authorSushil khanchi <sushilkhanchi97@gmail.com>
Thu, 12 Dec 2019 17:22:18 +0530
changeset 5012 5b5cfb9b0a0b
parent 5011 04104042c6ad
child 5013 18fe83bf7b14
evolve: remove the unnecessary condition to check empty successors set I annotated the history of this "newer == [()]" condition and found that it was added in the initial stages of evolution project (more than 8 years ago) and there is no test where we get [()] as a successor set. So looks like "if not newer" is enough to check if it is empty. I also looked into obsutil.successorssets() implementation and I don't think it would give us [()] in any case.
hgext3rd/evolve/evolvecmd.py
--- a/hgext3rd/evolve/evolvecmd.py	Tue Nov 19 14:54:13 2019 -0800
+++ b/hgext3rd/evolve/evolvecmd.py	Thu Dec 12 17:22:18 2019 +0530
@@ -124,7 +124,7 @@
     obs = pctx
     newer = obsutil.successorssets(repo, obs.node())
     # search of a parent which is not killed, but also isn't the orig
-    while not newer or newer == [()] or newer[0][0] == orig.node():
+    while not newer or newer[0][0] == orig.node():
         ui.debug(b"stabilize target %s is plain dead,"
                  b" trying to stabilize on its parent\n" %
                  obs)