Patchwork dispatch: also a separate warning message on aliases with --config

login
register
mail settings
Submitter Simon Heimberg
Date Feb. 12, 2013, 9:16 p.m.
Message ID <100c99318e8d112bc5d3.1360703813@lapsi.heimberg.home>
Download mbox | patch
Permalink /patch/966/
State Accepted
Commit 633cd0c46e6ade5de12ab434435ad0b6ee5578a4
Headers show

Comments

Simon Heimberg - Feb. 12, 2013, 9:16 p.m.
# HG changeset patch
# User Simon Heimberg <simohe@besonet.ch>
# Date 1360703731 -3600
# Node ID 100c99318e8d112bc5d3f0d3508a500196f2a617
# Parent  cbb8e2aa2162297859daeebbeabd40ed87797588
dispatch: also a separate warning message on aliases with --config

As mentioned in bug 2043, --config is also not supported in an alias. So report
this the same way as the other "early" options.

Example with alias.broken = stat --config a.config=1

Before:
  $ hg broken
  abort: Option --config may not be abbreviated!

After:
  $ hg broken
  error in definition for alias 'broken': --config may only be given on the command line
Augie Fackler - Feb. 12, 2013, 9:47 p.m.
Queued, thanks.

On Feb 12, 2013, at 4:16 PM, Simon Heimberg <simohe@besonet.ch> wrote:

> # HG changeset patch
> # User Simon Heimberg <simohe@besonet.ch>
> # Date 1360703731 -3600
> # Node ID 100c99318e8d112bc5d3f0d3508a500196f2a617
> # Parent  cbb8e2aa2162297859daeebbeabd40ed87797588
> dispatch: also a separate warning message on aliases with --config
> 
> As mentioned in bug 2043, --config is also not supported in an alias. So report
> this the same way as the other "early" options.
> 
> Example with alias.broken = stat --config a.config=1
> 
> Before:
>  $ hg broken
>  abort: Option --config may not be abbreviated!
> 
> After:
>  $ hg broken
>  error in definition for alias 'broken': --config may only be given on the command line
> 
> diff -r cbb8e2aa2162 -r 100c99318e8d mercurial/dispatch.py
> --- a/mercurial/dispatch.py	Mon Okt 15 23:28:45 2012 +0200
> +++ b/mercurial/dispatch.py	Die Feb 12 22:15:31 2013 +0100
> @@ -333,7 +333,7 @@
>         self.cmdname = cmd = args.pop(0)
>         args = map(util.expandpath, args)
> 
> -        for invalidarg in ("--cwd", "-R", "--repository", "--repo"):
> +        for invalidarg in ("--cwd", "-R", "--repository", "--repo", "--config"):
>             if _earlygetopt([invalidarg], args):
>                 def fn(ui, *args):
>                     ui.warn(_("error in definition for alias '%s': %s may only "
> diff -r cbb8e2aa2162 -r 100c99318e8d tests/test-alias.t
> --- a/tests/test-alias.t	Mon Okt 15 23:28:45 2012 +0200
> +++ b/tests/test-alias.t	Die Feb 12 22:15:31 2013 +0100
> @@ -17,6 +17,7 @@
>> no-R = status -R elsewhere
>> no--repo = status --repo elsewhere
>> no--repository = status --repository elsewhere
> +  > no--config = status --config a.config=1
>> mylog = log
>> lognull = log -r null
>> shortlog = log --template '{rev} {node|short} | {date|isodate}\n'
> @@ -106,6 +107,8 @@
>   error in definition for alias 'no--repository': --repository may only be given on the command line
>   $ hg help no--repository
>   error in definition for alias 'no--repository': --repository may only be given on the command line
> +  $ hg no--config
> +  error in definition for alias 'no--config': --config may only be given on the command line
> 
> optional repository
> 
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel

Patch

diff -r cbb8e2aa2162 -r 100c99318e8d mercurial/dispatch.py
--- a/mercurial/dispatch.py	Mon Okt 15 23:28:45 2012 +0200
+++ b/mercurial/dispatch.py	Die Feb 12 22:15:31 2013 +0100
@@ -333,7 +333,7 @@ 
         self.cmdname = cmd = args.pop(0)
         args = map(util.expandpath, args)
 
-        for invalidarg in ("--cwd", "-R", "--repository", "--repo"):
+        for invalidarg in ("--cwd", "-R", "--repository", "--repo", "--config"):
             if _earlygetopt([invalidarg], args):
                 def fn(ui, *args):
                     ui.warn(_("error in definition for alias '%s': %s may only "
diff -r cbb8e2aa2162 -r 100c99318e8d tests/test-alias.t
--- a/tests/test-alias.t	Mon Okt 15 23:28:45 2012 +0200
+++ b/tests/test-alias.t	Die Feb 12 22:15:31 2013 +0100
@@ -17,6 +17,7 @@ 
   > no-R = status -R elsewhere
   > no--repo = status --repo elsewhere
   > no--repository = status --repository elsewhere
+  > no--config = status --config a.config=1
   > mylog = log
   > lognull = log -r null
   > shortlog = log --template '{rev} {node|short} | {date|isodate}\n'
@@ -106,6 +107,8 @@ 
   error in definition for alias 'no--repository': --repository may only be given on the command line
   $ hg help no--repository
   error in definition for alias 'no--repository': --repository may only be given on the command line
+  $ hg no--config
+  error in definition for alias 'no--config': --config may only be given on the command line
 
 optional repository