--- a/hgext3rd/topic/__init__.py Mon Oct 30 19:24:14 2017 +0100
+++ b/hgext3rd/topic/__init__.py Wed Nov 01 16:26:33 2017 +0100
@@ -72,6 +72,27 @@
[experimental]
enforce-single-head = yes
+
+Publishing behavior
+===================
+
+Topic vanish when changeset move to the public phases. Moving to the public
+phase usually happens on push, but it is possible ot update that behavior. The
+server needs to have specific config for this.
+
+ # everything pushed become public (the default)
+ [phase]
+ publish = yes
+
+ # nothing push turned public
+ [phase]
+ publish = no
+
+ # topic branches are not published, changeset without topic are
+ [phase]
+ publish = no
+ [experimental]
+ topic.publish-bare-branch = yes
"""
from __future__ import absolute_import
@@ -168,6 +189,9 @@
configitem('experimental', 'topic-mode',
default=None,
)
+ configitem('experimental', 'topic.publish-bare-branch',
+ default=False,
+ )
configitem('_internal', 'keep-topic',
default=False,
)
@@ -381,8 +405,8 @@
if desc in ('strip', 'repair') or ctr is not None:
return tr
+ reporef = weakref.ref(self)
if repo.ui.configbool('experimental', 'enforce-single-head'):
- reporef = weakref.ref(self)
origvalidator = tr.validator
def validator(tr2):
@@ -391,6 +415,20 @@
origvalidator(tr2)
tr.validator = validator
+ if (repo.ui.configbool('experimental', 'topic.publish-bare-branch')
+ and (desc.startswith('push')
+ or desc.startswith('serve'))
+ ):
+ origclose = tr.close
+ trref = weakref.ref(tr)
+
+ def close():
+ repo = reporef()
+ tr2 = trref()
+ flow.publishbarebranch(repo, tr2)
+ origclose()
+ tr.close = close
+
# real transaction start
ct = self.currenttopic
if not ct: