hgext/split.py
changeset 46924 ca0049946e9a
parent 46923 8ee1ac083ee7
child 48116 5ced12cfa41b
--- a/hgext/split.py	Mon Apr 12 17:52:46 2021 -0700
+++ b/hgext/split.py	Mon Apr 12 19:25:34 2021 -0700
@@ -182,12 +182,15 @@
     if not committed:
         raise error.InputError(_(b'cannot split an empty revision'))
 
-    scmutil.cleanupnodes(
-        repo,
-        {ctx.node(): [c.node() for c in committed]},
-        operation=b'split',
-        fixphase=True,
-    )
+    if len(committed) != 1 or committed[0].node() != ctx.node():
+        # Ensure we don't strip a node if we produce the same commit as already
+        # exists
+        scmutil.cleanupnodes(
+            repo,
+            {ctx.node(): [c.node() for c in committed]},
+            operation=b'split',
+            fixphase=True,
+        )
 
     return committed[-1]