diff hgext/split.py @ 46923:8ee1ac083ee7

split: fix issue with empty splits adjusting phases Differential Revision: https://phab.mercurial-scm.org/D10388
author Kyle Lippincott <spectral@google.com>
date Mon, 12 Apr 2021 17:52:46 -0700
parents 728d89f6f9b1
children ca0049946e9a
line wrap: on
line diff
--- a/hgext/split.py	Mon Apr 12 17:51:56 2021 -0700
+++ b/hgext/split.py	Mon Apr 12 17:52:46 2021 -0700
@@ -171,9 +171,13 @@
                 b'message': header + ctx.description(),
             }
         )
+        origctx = repo[b'.']
         commands.commit(ui, repo, **pycompat.strkwargs(opts))
         newctx = repo[b'.']
-        committed.append(newctx)
+        # Ensure user didn't do a "no-op" split (such as deselecting
+        # everything).
+        if origctx.node() != newctx.node():
+            committed.append(newctx)
 
     if not committed:
         raise error.InputError(_(b'cannot split an empty revision'))