Mercurial > evolve
changeset 3020:361d83261d7a
topic: migrate experimental.enforce-topic to experimental.topic-mode
author | Boris Feld <boris.feld@octobus.net> |
---|---|
date | Sat, 30 Sep 2017 22:24:24 +0100 |
parents | dd3eda2f7a89 |
children | 5f4c42d4f2e8 |
files | hgext3rd/topic/__init__.py |
diffstat | 1 files changed, 15 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- 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")