topic: update the topic-mode hint
authorPierre-Yves David <pierre-yves.david@octobus.net>
Sun, 01 Oct 2017 09:10:48 +0100
changeset 3027 b220e2f5ebd5
parent 3026 e9935c2c4672
child 3028 c2d1f49ac7e2
topic: update the topic-mode hint The hint is now shorter and reference the documentation. That should provide more concise output with more details for user who seeks it.
hgext3rd/topic/__init__.py
tests/test-topic-tutorial.t
tests/test-topic.t
tests/test-topicmode.t
--- a/hgext3rd/topic/__init__.py	Sun Oct 01 09:05:42 2017 +0100
+++ b/hgext3rd/topic/__init__.py	Sun Oct 01 09:10:48 2017 +0100
@@ -925,17 +925,18 @@
             mayabort = True
             maywarn = False
 
+        hint = _("see 'hg help -e topic.topic-mode' for details")
         if opts.get('topic'):
             t = opts['topic']
             with repo.vfs.open('topic', 'w') as f:
                 f.write(t)
         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 notopic and maywarn:
             ui.warn(_("warning: new draft commit without topic\n"))
+            if not ui.quiet:
+                ui.warn(("(%s)") % hint)
         return orig(ui, repo, *args, **opts)
 
 def committextwrap(orig, repo, ctx, subs, extramsg):
--- a/tests/test-topic-tutorial.t	Sun Oct 01 09:05:42 2017 +0100
+++ b/tests/test-topic-tutorial.t	Sun Oct 01 09:10:48 2017 +0100
@@ -714,7 +714,7 @@
   $ echo sickle >> shopping
   $ hg commit -m 'Adding sickle'
   abort: no active topic
-  (set a current topic or use '--config experimental.topic-mode=off' to commit without a topic)
+  (see 'hg help -e topic.topic-mode' for details)
   [255]
 
 Ok, let's clean this up and delve into multiple topics.
--- a/tests/test-topic.t	Sun Oct 01 09:05:42 2017 +0100
+++ b/tests/test-topic.t	Sun Oct 01 09:10:48 2017 +0100
@@ -926,14 +926,14 @@
   $ hg add a
   $ hg ci -m "Added a"
   abort: no active topic
-  (set a current topic or use '--config experimental.topic-mode=off' to commit without a topic)
+  (see 'hg help -e topic.topic-mode' for details)
   [255]
 
 (same test, checking we abort before the editor)
 
   $ EDITOR=cat hg ci -m "Added a" --edit
   abort: no active topic
-  (set a current topic or use '--config experimental.topic-mode=off' to commit without a topic)
+  (see 'hg help -e topic.topic-mode' for details)
   [255]
   $ hg ci -m "added a" --config experimental.topic-mode=off
   $ hg log
--- a/tests/test-topicmode.t	Sun Oct 01 09:05:42 2017 +0100
+++ b/tests/test-topicmode.t	Sun Oct 01 09:10:48 2017 +0100
@@ -17,14 +17,14 @@
   $ hg add a
   $ hg ci -m "Added a"
   abort: no active topic
-  (set a current topic or use '--config experimental.topic-mode=off' to commit without a topic)
+  (see 'hg help -e topic.topic-mode' for details)
   [255]
 
 (same test, checking we abort before the editor)
 
   $ EDITOR=cat hg ci -m "Added a" --edit
   abort: no active topic
-  (set a current topic or use '--config experimental.topic-mode=off' to commit without a topic)
+  (see 'hg help -e topic.topic-mode' for details)
   [255]
   $ hg ci -m "added a" --config experimental.topic-mode=off
   $ hg log
@@ -52,11 +52,13 @@
   $ hg add a
   $ hg ci -m "Added a"
   warning: new draft commit without topic
+  (see 'hg help -e topic.topic-mode' for details) (no-eol)
 
 (same test, checking we abort before the editor)
 
   $ EDITOR=cat hg ci --amend -m "Added a" --edit
   warning: new draft commit without topic
+  (see 'hg help -e topic.topic-mode' for details) (no-eol)
   $ hg ci --amend -m "added a'" --config experimental.topic-mode=off
   $ hg log
   changeset:   2:2e862d8b5eff
@@ -101,6 +103,7 @@
   (branch merge, don't forget to commit)
   $ hg commit -m "merge mytopic"
   warning: new draft commit without topic
+  (see 'hg help -e topic.topic-mode' for details) (no-eol)
 
   $ hg log -G
   @    changeset:   3:676a445d1c09
@@ -163,7 +166,7 @@
   (branch merge, don't forget to commit)
   $ hg commit -m "merge mytopic"
   abort: no active topic
-  (set a current topic or use '--config experimental.topic-mode=off' to commit without a topic)
+  (see 'hg help -e topic.topic-mode' for details)
   [255]
 
   $ hg log -G