# HG changeset patch # User Pierre-Yves David # Date 1506813259 -3600 # Node ID 255e66783505603f3c97850df49c15fe2494e97c # Parent 5f4c42d4f2e8ab1b0240c86ce74538995ef1c954 topic: add documentation for the 'topic-mode' option This should help people to discover it. diff -r 5f4c42d4f2e8 -r 255e66783505 hgext3rd/topic/__init__.py --- a/hgext3rd/topic/__init__.py Sat Sep 30 22:42:52 2017 +0100 +++ b/hgext3rd/topic/__init__.py Sun Oct 01 00:14:19 2017 +0100 @@ -48,6 +48,17 @@ Be aware that this extension is still an experiment, commands and other features are likely to be change/adjusted/dropped over time as we refine the concept. + +Config option +============= + +The topic extension can be configured to ensure the user do not forget to add +a topic when committing a new topic:: + + [experimental] + # behavior when commit is made without an active topic + topic-mode = ignore # do nothing special (default) + topic-mode = enforce # abort the commit """ from __future__ import absolute_import @@ -875,6 +886,11 @@ # i18n: column positioning for "hg summary" ui.write(_("topic: %s\n") % ui.label(t, 'topic.active')) +_validmode = [ + 'ignore', + 'enforce', +] + def _configtopicmode(ui): """ Parse the config to get the topicmode """ @@ -885,6 +901,8 @@ enforcetopic = ui.configbool('experimental', 'enforce-topic') if enforcetopic: topicmode = "enforce" + if topicmode not in _validmode: + topicmode = _validmode[0] return topicmode