changeset 3123:b220e2f5ebd5

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.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Sun, 01 Oct 2017 09:10:48 +0100
parents e9935c2c4672
children c2d1f49ac7e2
files hgext3rd/topic/__init__.py tests/test-topic-tutorial.t tests/test-topic.t tests/test-topicmode.t
diffstat 4 files changed, 12 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/hgext3rd/topic/__init__.py
+++ b/hgext3rd/topic/__init__.py
@@ -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
+++ b/tests/test-topic-tutorial.t
@@ -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
+++ b/tests/test-topic.t
@@ -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
+++ b/tests/test-topicmode.t
@@ -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