[PATCH] for Issue2313: leading spaces in hgrc lead to parse error

Mads Kiilerich mads at kiilerich.com
Mon Jan 23 22:58:05 UTC 2012


Daniel Kullmann wrote, On 01/23/2012 11:19 AM:
> # HG changeset patch
> # User daniel.kullmann
> # Date 1327313882 -3600
> # Node ID a02356ac6be08d6c3c83d2133cb1f08ec9d76abe
> # Parent  878bc4a62a735a1624e9b69c672d5fb5074d4855
> fixed issue 3213: leading spaces in hgrc lead to parse error

Thanks for the patch, but please see 
http://mercurial.selenic.com/wiki/ContributingChanges , especially:
- your ui.username should contain a real email address - and preferably 
also your real name
- the summary line should use the right format

Please also use some extra lines to describe the problem (the error 
message you got) and why the problem should be solved this way.

> diff -r 878bc4a62a73 -r a02356ac6be0 mercurial/config.py
> --- a/mercurial/config.py    Thu Jan 19 14:31:05 2012 -0600
> +++ b/mercurial/config.py    Mon Jan 23 11:18:02 2012 +0100
> @@ -127,6 +127,8 @@
>                       continue
>                   item = None
>                   cont = False
> +            else:
> +                l = l.lstrip()
>               m = includere.match(l)
>               if m:
>                   inc = util.expandpath(m.group(1))

This seems to be different from your conclusion on the bug tracker? Why?

If you want to give a more specific error message then I suggest 
something like:

             m = contre.match(l)
             if cont:
                 ...
                 if m:
                     ...
             elif m:
                 raise error.ParseError(...

Please also extend or modify a test so we can see what it changes and 
make sure it stays that way.

/Mads




More information about the Mercurial-devel mailing list