46 will evolve all changesets in the active topic. In addition, by default. 'hg |
46 will evolve all changesets in the active topic. In addition, by default. 'hg |
47 next' and 'hg prev' will stick to the current topic. |
47 next' and 'hg prev' will stick to the current topic. |
48 |
48 |
49 Be aware that this extension is still an experiment, commands and other features |
49 Be aware that this extension is still an experiment, commands and other features |
50 are likely to be change/adjusted/dropped over time as we refine the concept. |
50 are likely to be change/adjusted/dropped over time as we refine the concept. |
|
51 |
|
52 Config option |
|
53 ============= |
|
54 |
|
55 The topic extension can be configured to ensure the user do not forget to add |
|
56 a topic when committing a new topic:: |
|
57 |
|
58 [experimental] |
|
59 # behavior when commit is made without an active topic |
|
60 topic-mode = ignore # do nothing special (default) |
|
61 topic-mode = enforce # abort the commit |
51 """ |
62 """ |
52 |
63 |
53 from __future__ import absolute_import |
64 from __future__ import absolute_import |
54 |
65 |
55 import re |
66 import re |
873 if not t: |
884 if not t: |
874 return |
885 return |
875 # i18n: column positioning for "hg summary" |
886 # i18n: column positioning for "hg summary" |
876 ui.write(_("topic: %s\n") % ui.label(t, 'topic.active')) |
887 ui.write(_("topic: %s\n") % ui.label(t, 'topic.active')) |
877 |
888 |
|
889 _validmode = [ |
|
890 'ignore', |
|
891 'enforce', |
|
892 ] |
|
893 |
878 def _configtopicmode(ui): |
894 def _configtopicmode(ui): |
879 """ Parse the config to get the topicmode |
895 """ Parse the config to get the topicmode |
880 """ |
896 """ |
881 topicmode = ui.config('experimental', 'topic-mode', default=None) |
897 topicmode = ui.config('experimental', 'topic-mode', default=None) |
882 |
898 |
883 # Fallback to read enforce-topic |
899 # Fallback to read enforce-topic |
884 if topicmode is None: |
900 if topicmode is None: |
885 enforcetopic = ui.configbool('experimental', 'enforce-topic') |
901 enforcetopic = ui.configbool('experimental', 'enforce-topic') |
886 if enforcetopic: |
902 if enforcetopic: |
887 topicmode = "enforce" |
903 topicmode = "enforce" |
|
904 if topicmode not in _validmode: |
|
905 topicmode = _validmode[0] |
888 |
906 |
889 return topicmode |
907 return topicmode |
890 |
908 |
891 def commitwrap(orig, ui, repo, *args, **opts): |
909 def commitwrap(orig, ui, repo, *args, **opts): |
892 with repo.wlock(): |
910 with repo.wlock(): |