changeset 43874:c6feee1e4d5b

rebase: make rebase not crash if p1 == p2 != nullid While this shouldn't happen normally, some historical bugs can have caused this kind of commit to exist. Instead of crashing and having it be unobvious how to recover, let's try to continue on. Without this, we get an error like "ValueError: min() arg is an empty sequence" Differential Revision: https://phab.mercurial-scm.org/D7664
author Kyle Lippincott <spectral@google.com>
date Fri, 13 Dec 2019 15:46:25 -0800
parents 8caec25f5d8f
children 8376d5d62d36
files hgext/rebase.py
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/rebase.py	Wed Dec 11 19:42:05 2019 -0800
+++ b/hgext/rebase.py	Fri Dec 13 15:46:25 2019 -0800
@@ -1791,7 +1791,7 @@
     # But our merge base candidates (D and E in above case) could still be
     # better than the default (ancestor(F, Z) == null). Therefore still
     # pick one (so choose p1 above).
-    if sum(1 for b in bases if b != nullrev) > 1:
+    if sum(1 for b in set(bases) if b != nullrev) > 1:
         unwanted = [None, None]  # unwanted[i]: unwanted revs if choose bases[i]
         for i, base in enumerate(bases):
             if base == nullrev: