mercurial/commit.py
changeset 45794 330c258fe7ca
parent 45790 5d65e04b6a80
parent 45757 067707e026b4
child 45942 89a2afe31e82
--- a/mercurial/commit.py	Sat Oct 17 21:57:21 2020 +0900
+++ b/mercurial/commit.py	Thu Oct 29 00:17:12 2020 -0700
@@ -79,6 +79,9 @@
         if repo.changelog._copiesstorage == b'extra':
             extra = _extra_with_copies(repo, extra, files)
 
+        # save the tip to check whether we actually committed anything
+        oldtip = repo.changelog.tiprev()
+
         # update changelog
         repo.ui.note(_(b"committing changelog\n"))
         repo.changelog.delayupdate(tr)
@@ -99,7 +102,11 @@
         )
         # set the new commit is proper phase
         targetphase = subrepoutil.newcommitphase(repo.ui, ctx)
-        if targetphase:
+
+        # prevent unmarking changesets as public on recommit
+        waspublic = oldtip == repo.changelog.tiprev() and not repo[n].phase()
+
+        if targetphase and not waspublic:
             # retract boundary do not alter parent changeset.
             # if a parent have higher the resulting phase will
             # be compliant anyway