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

Sean Farley sean.michael.farley at gmail.com
Sun Mar 16 15:52:51 CDT 2014


Razvan Cojocaru <razvan.cojocaru93 at gmail.com> writes:

> # 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"))

This looks straight-forward enough (maybe some bikeshedding could be
done with the wording) but needs a test added so we don't regress.


More information about the Mercurial-devel mailing list