# HG changeset patch # User Boris Feld # Date 1506806664 -3600 # Node ID 361d83261d7a7fd347b47e602a50169bdc0a1df8 # Parent dd3eda2f7a89d24ec7e42ba08ea1bd1d76cd429d topic: migrate experimental.enforce-topic to experimental.topic-mode diff -r dd3eda2f7a89 -r 361d83261d7a hgext3rd/topic/__init__.py --- 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")