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

Razvan Cojocaru razvan.cojocaru93 at gmail.com
Sun Mar 16 10:46:49 CDT 2014


# 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.

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


More information about the Mercurial-devel mailing list