[PATCH] dispatch: also a separate warning message on aliases with --config

Simon Heimberg simohe at besonet.ch
Tue Feb 12 15:16:53 CST 2013


# HG changeset patch
# User Simon Heimberg <simohe at 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
 


More information about the Mercurial-devel mailing list