mercurial/cmdutil.py
changeset 45812 976b26bdd0d8
parent 45796 e9555305c5c6
child 45827 8d72e29ad1e0
--- a/mercurial/cmdutil.py	Tue Oct 06 13:34:51 2020 +0200
+++ b/mercurial/cmdutil.py	Thu Oct 29 13:54:25 2020 +0100
@@ -3113,13 +3113,18 @@
     return b"\n".join(edittext)
 
 
-def commitstatus(repo, node, branch, bheads=None, opts=None):
+def commitstatus(repo, node, branch, bheads=None, tip=None, opts=None):
     if opts is None:
         opts = {}
     ctx = repo[node]
     parents = ctx.parents()
 
-    if (
+    if tip is not None and repo.changelog.tip() == tip:
+        # avoid reporting something like "committed new head" when
+        # recommitting old changesets, and issue a helpful warning
+        # for most instances
+        repo.ui.warn(_("warning: commit already existed in the repository!\n"))
+    elif (
         not opts.get(b'amend')
         and bheads
         and node not in bheads