diff mercurial/commit.py @ 45817:330c258fe7ca

branching: merge with stable
author Martin von Zweigbergk <martinvonz@google.com>
date Thu, 29 Oct 2020 00:17:12 -0700
parents 5d65e04b6a80 067707e026b4
children 89a2afe31e82
line wrap: on
line diff
--- 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