--- a/hgext3rd/topic/__init__.py Sat Sep 30 12:35:49 2017 +0100
+++ b/hgext3rd/topic/__init__.py Sat Sep 30 22:24:24 2017 +0100
@@ -875,14 +875,27 @@
# i18n: column positioning for "hg summary"
ui.write(_("topic: %s\n") % ui.label(t, 'topic.active'))
+def _configtopicmode(ui):
+ """ Parse the config to get the topicmode
+ """
+ topicmode = ui.config('experimental', 'topic-mode', default=None)
+
+ # Fallback to read enforce-topic
+ if topicmode is None:
+ enforcetopic = ui.configbool('experimental', 'enforce-topic')
+ if enforcetopic:
+ topicmode = "enforce"
+
+ return topicmode
+
def commitwrap(orig, ui, repo, *args, **opts):
with repo.wlock():
- enforcetopic = ui.configbool('experimental', 'enforce-topic')
+ topicmode = _configtopicmode(ui)
if opts.get('topic'):
t = opts['topic']
with repo.vfs.open('topic', 'w') as f:
f.write(t)
- elif not repo.currenttopic and enforcetopic:
+ elif not repo.currenttopic and topicmode == "enforce":
msg = _("no active topic")
hint = _("set a current topic or use '--config " +
"experimental.enforce-topic=no' to commit without a topic")