hgext3rd/topic/__init__.py
changeset 3028 c2d1f49ac7e2
parent 3027 b220e2f5ebd5
child 3030 581a6b9d2c8c
--- a/hgext3rd/topic/__init__.py	Sun Oct 01 09:10:48 2017 +0100
+++ b/hgext3rd/topic/__init__.py	Sun Oct 01 00:35:28 2017 +0100
@@ -61,6 +61,7 @@
     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)
 """
 
 from __future__ import absolute_import
@@ -101,6 +102,7 @@
     stack,
     topicmap,
     discovery,
+    randomname
 )
 
 if util.safehasattr(registrar, 'command'):
@@ -893,6 +895,7 @@
     'warning',
     'enforce',
     'enforce-all',
+    'random',
 ]
 
 def _configtopicmode(ui):
@@ -937,6 +940,9 @@
             ui.warn(_("warning: new draft commit without topic\n"))
             if not ui.quiet:
                 ui.warn(("(%s)") % hint)
+        elif notopic and topicmode == "random":
+            with repo.vfs.open('topic', 'w') as f:
+                f.write(randomname.randomtopicname(ui))
         return orig(ui, repo, *args, **opts)
 
 def committextwrap(orig, repo, ctx, subs, extramsg):