Mercurial > public > mercurial-scm > hg-stable
diff mercurial/dispatch.py @ 22276:b13b99d39a46
config: highlight parse error caused by leading spaces (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.
author | Razvan Cojocaru <razvan.cojocaru93@gmail.com> |
---|---|
date | Sun, 16 Mar 2014 17:31:31 +0200 |
parents | efd65e51bc0b |
children | c828b61e0635 |
line wrap: on
line diff
--- a/mercurial/dispatch.py Wed Aug 20 22:52:56 2014 -0700 +++ 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 @@ -155,6 +157,8 @@ if len(inst.args) > 1: ui.warn(_("hg: parse error at %s: %s\n") % (inst.args[1], inst.args[0])) + if (inst.args[0][0] == ' '): + ui.warn(_("unexpected leading whitespace\n")) else: ui.warn(_("hg: parse error: %s\n") % inst.args[0]) return -1