Mercurial > evolve
comparison hgext3rd/topic/__init__.py @ 3023:cc740c545776
topicmode: add new warning topicmode
author | Boris Feld <boris.feld@octobus.net> |
---|---|
date | Sat, 30 Sep 2017 23:00:21 +0100 |
parents | 255e66783505 |
children | 89855920fb0f |
comparison
equal
deleted
inserted
replaced
3022:255e66783505 | 3023:cc740c545776 |
---|---|
56 a topic when committing a new topic:: | 56 a topic when committing a new topic:: |
57 | 57 |
58 [experimental] | 58 [experimental] |
59 # behavior when commit is made without an active topic | 59 # behavior when commit is made without an active topic |
60 topic-mode = ignore # do nothing special (default) | 60 topic-mode = ignore # do nothing special (default) |
61 topic-mode = warning # print a warning | |
61 topic-mode = enforce # abort the commit | 62 topic-mode = enforce # abort the commit |
62 """ | 63 """ |
63 | 64 |
64 from __future__ import absolute_import | 65 from __future__ import absolute_import |
65 | 66 |
886 # i18n: column positioning for "hg summary" | 887 # i18n: column positioning for "hg summary" |
887 ui.write(_("topic: %s\n") % ui.label(t, 'topic.active')) | 888 ui.write(_("topic: %s\n") % ui.label(t, 'topic.active')) |
888 | 889 |
889 _validmode = [ | 890 _validmode = [ |
890 'ignore', | 891 'ignore', |
892 'warning', | |
891 'enforce', | 893 'enforce', |
892 ] | 894 ] |
893 | 895 |
894 def _configtopicmode(ui): | 896 def _configtopicmode(ui): |
895 """ Parse the config to get the topicmode | 897 """ Parse the config to get the topicmode |
916 elif not repo.currenttopic and topicmode == "enforce": | 918 elif not repo.currenttopic and topicmode == "enforce": |
917 msg = _("no active topic") | 919 msg = _("no active topic") |
918 hint = _("set a current topic or use '--config " + | 920 hint = _("set a current topic or use '--config " + |
919 "experimental.topic-mode=off' to commit without a topic") | 921 "experimental.topic-mode=off' to commit without a topic") |
920 raise error.Abort(msg, hint=hint) | 922 raise error.Abort(msg, hint=hint) |
923 elif not repo.currenttopic and topicmode == 'warning': | |
924 ui.warn(_("warning: new draft commit without topic\n")) | |
921 return orig(ui, repo, *args, **opts) | 925 return orig(ui, repo, *args, **opts) |
922 | 926 |
923 def committextwrap(orig, repo, ctx, subs, extramsg): | 927 def committextwrap(orig, repo, ctx, subs, extramsg): |
924 ret = orig(repo, ctx, subs, extramsg) | 928 ret = orig(repo, ctx, subs, extramsg) |
925 t = repo.currenttopic | 929 t = repo.currenttopic |