hgext3rd/topic/__init__.py
changeset 3030 581a6b9d2c8c
parent 3028 c2d1f49ac7e2
child 3038 103244e34a9c
--- a/hgext3rd/topic/__init__.py	Sun Oct 01 10:44:23 2017 +0100
+++ b/hgext3rd/topic/__init__.py	Sun Oct 01 11:13:38 2017 +0100
@@ -61,7 +61,8 @@
     topic-mode = warning # print a warning
     topic-mode = enforce # abort the commit (except for merge)
     topic-mode = enforce-all # abort the commit (even for merge)
-    topic-mode = random # use a randomized generated topic (even for merge)
+    topic-mode = random # use a randomized generated topic (except for merge)
+    topic-mode = random-all # use a randomized generated topic (even for merge)
 """
 
 from __future__ import absolute_import
@@ -896,6 +897,7 @@
     'enforce',
     'enforce-all',
     'random',
+    'random-all',
 ]
 
 def _configtopicmode(ui):
@@ -923,6 +925,12 @@
         maywarn = (topicmode == "warning"
                    or (topicmode == "enforce" and ismergecommit))
 
+        mayrandom = False
+        if topicmode == "random":
+            mayrandom = not ismergecommit
+        elif topicmode == "random-all":
+            mayrandom = True
+
         if topicmode == 'enforce-all':
             ismergecommit = False
             mayabort = True
@@ -940,7 +948,7 @@
             ui.warn(_("warning: new draft commit without topic\n"))
             if not ui.quiet:
                 ui.warn(("(%s)") % hint)
-        elif notopic and topicmode == "random":
+        elif notopic and mayrandom:
             with repo.vfs.open('topic', 'w') as f:
                 f.write(randomname.randomtopicname(ui))
         return orig(ui, repo, *args, **opts)