diff mercurial/localrepo.py @ 42971:76608f9f27f6

singlehead: introduce special handling of closed heads Until now, the experimental option `single-head-per-branch` was also refusing closed heads. The logic is now ignoring them by default and a suboption have been added to refuse them too `single-head-per-branch:account-closed-heads`.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Wed, 25 Sep 2019 12:59:26 +0200
parents 3df3b139a43d
children 188476e48f51
line wrap: on
line diff
--- a/mercurial/localrepo.py	Wed Sep 25 12:57:11 2019 +0200
+++ b/mercurial/localrepo.py	Wed Sep 25 12:59:26 2019 +0200
@@ -1920,8 +1920,13 @@
             # gating.
             tracktags(tr2)
             repo = reporef()
-            if repo.ui.configbool('experimental', 'single-head-per-branch'):
-                scmutil.enforcesinglehead(repo, tr2, desc)
+
+            r = repo.ui.configsuboptions('experimental',
+                                         'single-head-per-branch')
+            singlehead, singleheadsub = r
+            if singlehead:
+                accountclosed = singleheadsub.get("account-closed-heads", False)
+                scmutil.enforcesinglehead(repo, tr2, desc, accountclosed)
             if hook.hashook(repo.ui, 'pretxnclose-bookmark'):
                 for name, (old, new) in sorted(tr.changes['bookmarks'].items()):
                     args = tr.hookargs.copy()