diff mercurial/localrepo.py @ 46097:4d5e2fd53707

singlehead: introduce option to restrict to public changes The new experimental.single-head-per-branch:public-changes-only option restricts the single-head-per-branch filter to public changesets. This is useful when serving one repository with different views as publishing and non-publishing repository. Differential Revision: https://phab.mercurial-scm.org/D9525
author Joerg Sonnenberger <joerg@bec.de>
date Sat, 05 Dec 2020 23:35:55 +0100
parents 49b4ab1d9f5e
children c6ae1982b2a1
line wrap: on
line diff
--- a/mercurial/localrepo.py	Thu Dec 03 14:39:39 2020 -0800
+++ b/mercurial/localrepo.py	Sat Dec 05 23:35:55 2020 +0100
@@ -2254,7 +2254,13 @@
                 accountclosed = singleheadsub.get(
                     b"account-closed-heads", False
                 )
-                scmutil.enforcesinglehead(repo, tr2, desc, accountclosed)
+                if singleheadsub.get(b"public-changes-only", False):
+                    filtername = b"immutable"
+                else:
+                    filtername = b"visible"
+                scmutil.enforcesinglehead(
+                    repo, tr2, desc, accountclosed, filtername
+                )
             if hook.hashook(repo.ui, b'pretxnclose-bookmark'):
                 for name, (old, new) in sorted(
                     tr.changes[b'bookmarks'].items()