[PATCH 2 of 2 stable] help: don't crash on help for 'sections' with multiple '.'

Mads Kiilerich mads at kiilerich.com
Sat Nov 1 13:03:38 CDT 2014


# HG changeset patch
# User Mads Kiilerich <madski at unity3d.com>
# Date 1414864951 -3600
#      Sat Nov 01 19:02:31 2014 +0100
# Branch stable
# Node ID 234760fc00651b8b915382c3782588dcd42b63a7
# Parent  099b15767a3bd6392c3d71a3ada377e23534f06c
help: don't crash on help for 'sections' with multiple '.'

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -3837,7 +3837,7 @@ def help_(ui, name=None, **opts):
 
     section = None
     if name and '.' in name:
-        name, section = name.split('.')
+        name, section = name.split('.', 1)
 
     text = help.help_(ui, name, **opts)
 
diff --git a/tests/test-help.t b/tests/test-help.t
--- a/tests/test-help.t
+++ b/tests/test-help.t
@@ -1094,6 +1094,10 @@ Test section lookup
   abort: help section not found
   [255]
 
+  $ hg help glossary.mc.guffin
+  abort: help section not found
+  [255]
+
 Test usage of section marks in help documents
 
   $ cd "$TESTDIR"/../doc


More information about the Mercurial-devel mailing list