923 if topicmode == 'enforce-all': |
923 if topicmode == 'enforce-all': |
924 ismergecommit = False |
924 ismergecommit = False |
925 mayabort = True |
925 mayabort = True |
926 maywarn = False |
926 maywarn = False |
927 |
927 |
|
928 hint = _("see 'hg help -e topic.topic-mode' for details") |
928 if opts.get('topic'): |
929 if opts.get('topic'): |
929 t = opts['topic'] |
930 t = opts['topic'] |
930 with repo.vfs.open('topic', 'w') as f: |
931 with repo.vfs.open('topic', 'w') as f: |
931 f.write(t) |
932 f.write(t) |
932 elif notopic and mayabort: |
933 elif notopic and mayabort: |
933 msg = _("no active topic") |
934 msg = _("no active topic") |
934 hint = _("set a current topic or use '--config " + |
|
935 "experimental.topic-mode=off' to commit without a topic") |
|
936 raise error.Abort(msg, hint=hint) |
935 raise error.Abort(msg, hint=hint) |
937 elif notopic and maywarn: |
936 elif notopic and maywarn: |
938 ui.warn(_("warning: new draft commit without topic\n")) |
937 ui.warn(_("warning: new draft commit without topic\n")) |
|
938 if not ui.quiet: |
|
939 ui.warn(("(%s)") % hint) |
939 return orig(ui, repo, *args, **opts) |
940 return orig(ui, repo, *args, **opts) |
940 |
941 |
941 def committextwrap(orig, repo, ctx, subs, extramsg): |
942 def committextwrap(orig, repo, ctx, subs, extramsg): |
942 ret = orig(repo, ctx, subs, extramsg) |
943 ret = orig(repo, ctx, subs, extramsg) |
943 t = repo.currenttopic |
944 t = repo.currenttopic |