--- a/hgext3rd/topic/__init__.py Sat Sep 30 23:00:21 2017 +0100
+++ b/hgext3rd/topic/__init__.py Sat Sep 30 23:18:29 2017 +0100
@@ -59,7 +59,7 @@
# behavior when commit is made without an active topic
topic-mode = ignore # do nothing special (default)
topic-mode = warning # print a warning
- topic-mode = enforce # abort the commit
+ topic-mode = enforce # abort the commit (except for merge)
"""
from __future__ import absolute_import
@@ -911,16 +911,23 @@
def commitwrap(orig, ui, repo, *args, **opts):
with repo.wlock():
topicmode = _configtopicmode(ui)
+ ismergecommit = len(repo[None].parents()) == 2
+
+ notopic = not repo.currenttopic
+ mayabort = (topicmode == "enforce" and not ismergecommit)
+ maywarn = (topicmode == "warning"
+ or (topicmode == "enforce" and ismergecommit))
+
if opts.get('topic'):
t = opts['topic']
with repo.vfs.open('topic', 'w') as f:
f.write(t)
- elif not repo.currenttopic and topicmode == "enforce":
+ elif notopic and mayabort:
msg = _("no active topic")
hint = _("set a current topic or use '--config " +
"experimental.topic-mode=off' to commit without a topic")
raise error.Abort(msg, hint=hint)
- elif not repo.currenttopic and topicmode == 'warning':
+ elif notopic and maywarn:
ui.warn(_("warning: new draft commit without topic\n"))
return orig(ui, repo, *args, **opts)