Patchwork [1,of,3] help: show section that couldn't be found

login
register
mail settings
Submitter Yuya Nishihara
Date Feb. 5, 2017, 10:27 a.m.
Message ID <84d52bc1463f12a81849.1486290468@mimosa>
Download mbox | patch
Permalink /patch/18328/
State Accepted
Headers show

Comments

Yuya Nishihara - Feb. 5, 2017, 10:27 a.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1486288639 -32400
#      Sun Feb 05 18:57:19 2017 +0900
# Node ID 84d52bc1463f12a818494181b9f67b25b6fa645f
# Parent  8d7e40524ae467b3201e264e3548681c52bb6492
help: show section that couldn't be found

For better error indication.

Patch

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -3916,6 +3916,7 @@  def help_(ui, name=None, **opts):
     if ui.verbose:
         keep.append('verbose')
 
+    fullname = name
     section = None
     subtopic = None
     if name and '.' in name:
@@ -3938,7 +3939,7 @@  def help_(ui, name=None, **opts):
     # to look for, or we could have simply failed to found "foo.bar"
     # because bar isn't a section of foo
     if section and not (formatted and name):
-        raise error.Abort(_("help section not found"))
+        raise error.Abort(_("help section not found: %s") % fullname)
 
     if 'verbose' in pruned:
         keep.append('omitted')
diff --git a/tests/test-help.t b/tests/test-help.t
--- a/tests/test-help.t
+++ b/tests/test-help.t
@@ -1547,11 +1547,11 @@  Test section lookup
          "default:pushurl" should be used instead.
   
   $ hg help glossary.mcguffin
-  abort: help section not found
+  abort: help section not found: glossary.mcguffin
   [255]
 
   $ hg help glossary.mc.guffin
-  abort: help section not found
+  abort: help section not found: glossary.mc.guffin
   [255]
 
   $ hg help template.files