Patchwork dispatch: hgrc parse error caused by leading spaces are hard to spot (issue3214)

login
register
mail settings
Submitter Razvan Cojocaru
Date March 16, 2014, 3:56 p.m.
Message ID <36b2c20df50cb87d2611.1394985398@razvan-Inspiron-5720>
Download mbox | patch
Permalink /patch/3952/
State Superseded
Headers show

Comments

Razvan Cojocaru - March 16, 2014, 3:56 p.m.
# HG changeset patch
# User razvancojocaru
# Date 1394983891 -7200
#      Sun Mar 16 17:31:31 2014 +0200
# Node ID 36b2c20df50cb87d261189629db0400380b8100e
# Parent  05267e6e94dd36461d9018743540506c65cabcf1
dispatch:  hgrc parse error caused by leading spaces are hard to spot (issue3214)

Added "Unexpected leading whitespace" message to parse error
when .hgrc has a line that starts with whitespace.
Helps new users unfamiliar with syntax of rc file.

Patch

diff -r 05267e6e94dd -r 36b2c20df50c mercurial/dispatch.py
--- a/mercurial/dispatch.py	Mon Feb 17 07:39:53 2014 +0100
+++ b/mercurial/dispatch.py	Sun Mar 16 17:31:31 2014 +0200
@@ -58,6 +58,8 @@ 
         if len(inst.args) > 1:
             ferr.write(_("hg: parse error at %s: %s\n") %
                              (inst.args[1], inst.args[0]))
+            if (inst.args[0][0] == ' '):
+                ferr.write(_("Unexpected leading whitespace\n"))
         else:
             ferr.write(_("hg: parse error: %s\n") % inst.args[0])
         return -1