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

login
register
mail settings
Submitter Mads Kiilerich
Date Nov. 1, 2014, 6:03 p.m.
Message ID <234760fc00651b8b9153.1414865018@localhost.localdomain>
Download mbox | patch
Permalink /patch/6508/
State Accepted
Headers show

Comments

Mads Kiilerich - Nov. 1, 2014, 6:03 p.m.
# HG changeset patch
# User Mads Kiilerich <madski@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 '.'
Matt Mackall - Nov. 1, 2014, 6:09 p.m.
On Sat, 2014-11-01 at 19:03 +0100, Mads Kiilerich wrote:
> # HG changeset patch
> # User Mads Kiilerich <madski@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 '.'

These are queued for stable, thanks.

Patch

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