[PATCH 5 of 5 STABLE RFC] dispatch: ignore --early-list-opt that might not be a flag (BC)

Yuya Nishihara yuya at tcha.org
Wed Nov 15 07:54:24 EST 2017


# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1510321154 -32400
#      Fri Nov 10 22:39:14 2017 +0900
# Branch stable
# Node ID f1892a7fd3fdca0401072041774be62a1774bacd
# Parent  c2c34cf080aefbd983320bdaca111ebbd0826ff3
dispatch: ignore --early-list-opt that might not be a flag (BC)

As you can see, not a few tests have to be updated because of this change.
Given we use --config/--cwd/-R more extensively in tests, this might not
be terrible in real word, but I don't know.

So, what can we do?

 a) enable this by default
 b) or, add config knob or env var to enable this
 c) or, add config knob or env var to enable more restricted version
    ...

diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py
--- a/mercurial/dispatch.py
+++ b/mercurial/dispatch.py
@@ -692,6 +692,38 @@ def _earlygetopt(aliases, args, strip=Tr
     >>> args = [b'x', b'-R', b'--', b'y']
     >>> _earlygetopt([b'-R'], args), args
     ([], ['x', '-R', '--', 'y'])
+
+    Options can't appear immediately after any option-like flag:
+
+    >>> args = [b'x', b'-b', b'--cwd', b'foo']
+    >>> _earlygetopt([b'--cwd'], args), args
+    ([], ['x', '-b', '--cwd', 'foo'])
+
+    >>> args = [b'x', b'-b', b'--branch', b'--cwd', b'foo']
+    >>> _earlygetopt([b'--cwd'], args), args
+    ([], ['x', '-b', '--branch', '--cwd', 'foo'])
+
+    >>> args = [b'x', b'--branch', b'--cwd', b'foo']
+    >>> _earlygetopt([b'--cwd'], args), args
+    ([], ['x', '--branch', '--cwd', 'foo'])
+
+    unless the preceding flag is known to be a boolean:
+
+    >>> args = [b'x', b'--time', b'--cwd', b'foo']
+    >>> _earlygetopt([b'--cwd'], args), args
+    (['foo'], ['x', '--time'])
+
+    or is known to be a value for the previous early option:
+
+    >>> args = [b'x', b'--cwd', b'--foo', b'--cwd', b'--bar', b'baz']
+    >>> _earlygetopt([b'--cwd'], args), args
+    (['--foo', '--bar'], ['x', 'baz'])
+
+    or the preceding flag takes an immediate value:
+
+    >>> args = [b'x', b'--foo=bar', b'--cwd', b'baz']
+    >>> _earlygetopt([b'--cwd'], args), args
+    (['baz'], ['x', '--foo=bar'])
     """
     try:
         argcount = args.index("--")
@@ -699,6 +731,7 @@ def _earlygetopt(aliases, args, strip=Tr
         argcount = len(args)
     shortopts = [opt for opt in aliases if len(opt) == 2]
     values = []
+    inopt = False
     pos = 0
     while pos < argcount:
         fullarg = arg = args[pos]
@@ -707,7 +740,7 @@ def _earlygetopt(aliases, args, strip=Tr
             equals = arg.find('=')
         if equals > -1:
             arg = arg[:equals]
-        if arg in aliases:
+        if arg in aliases and not inopt:
             if equals > -1:
                 values.append(fullarg[equals + 1:])
                 if strip:
@@ -725,7 +758,7 @@ def _earlygetopt(aliases, args, strip=Tr
                     argcount -= 2
                 else:
                     pos += 2
-        elif arg[:2] in shortopts:
+        elif arg[:2] in shortopts and not inopt:
             # short option can have no following space, e.g. hg log -Rfoo
             values.append(args[pos][2:])
             if strip:
@@ -734,6 +767,7 @@ def _earlygetopt(aliases, args, strip=Tr
             else:
                 pos += 1
         else:
+            inopt = _argmaytakevalue(fullarg)
             pos += 1
     return values
 
@@ -927,13 +961,16 @@ def _dispatch(req):
         cmd, func, args, options, cmdoptions = _parse(lui, args)
 
         if options["config"] != req.earlyoptions["config"]:
-            raise error.Abort(_("option --config may not be abbreviated!"))
+            raise error.Abort(_("option --config may not be abbreviated "
+                                "and should come very first!"))
         if options["cwd"] != req.earlyoptions["cwd"]:
-            raise error.Abort(_("option --cwd may not be abbreviated!"))
+            raise error.Abort(_("option --cwd may not be abbreviated "
+                                "and should come very first!"))
         if options["repository"] != req.earlyoptions["repository"]:
             raise error.Abort(_(
                 "option -R has to be separated from other options (e.g. not "
-                "-qR) and --repository may only be abbreviated as --repo!"))
+                "-qR), --repository may only be abbreviated as --repo, "
+                "and the option should come very first!"))
         if options["debugger"] != req.earlyoptions["debugger"]:
             raise error.Abort(_("option --debugger may not be abbreviated "
                                 "and should come very first!"))
diff --git a/tests/test-amend.t b/tests/test-amend.t
--- a/tests/test-amend.t
+++ b/tests/test-amend.t
@@ -140,7 +140,7 @@ Interactive mode
 
   $ touch F G
   $ hg add F G
-  $ cat <<EOS | hg amend -i --config ui.interactive=1
+  $ cat <<EOS | hg amend --config ui.interactive=1 -i
   > y
   > n
   > EOS
diff --git a/tests/test-automv.t b/tests/test-automv.t
--- a/tests/test-automv.t
+++ b/tests/test-automv.t
@@ -227,7 +227,7 @@ mv/rm/add/modif/changethreshold
   $ hg status -C
   A b.txt
   R a.txt
-  $ hg commit --amend --config automv.similarity='60' -m 'amended'
+  $ hg commit --config automv.similarity='60' --amend -m 'amended'
   detected move of 1 files
   saved backup bundle to $TESTTMP/repo/.hg/strip-backup/*-amend.hg (glob)
   $ hg status --change . -C
diff --git a/tests/test-chg.t b/tests/test-chg.t
--- a/tests/test-chg.t
+++ b/tests/test-chg.t
@@ -59,8 +59,9 @@ by default, system() should be redirecte
 but no redirection should be made if output is captured:
 
   $ touch bar
-  $ CHGDEBUG= HGEDITOR=cat chg ci -Am bufferred --edit \
-  > --config extensions.pushbuffer="$TESTTMP/pushbuffer.py" 2>&1 \
+  $ CHGDEBUG= HGEDITOR=cat chg ci \
+  > --config extensions.pushbuffer="$TESTTMP/pushbuffer.py" \
+  > -Am bufferred --edit 2>&1 \
   > | egrep "HG:|run 'cat"
   [1]
 
diff --git a/tests/test-clone.t b/tests/test-clone.t
--- a/tests/test-clone.t
+++ b/tests/test-clone.t
@@ -136,7 +136,7 @@ Check that we drop the 'file:' from the 
 
 Check that path aliases are expanded:
 
-  $ hg clone -q -U --config 'paths.foobar=a#0' foobar f
+  $ hg clone --config 'paths.foobar=a#0' -q -U foobar f
   $ hg -R f showconfig paths.default
   $TESTTMP/a#0 (glob)
 
diff --git a/tests/test-command-template.t b/tests/test-command-template.t
--- a/tests/test-command-template.t
+++ b/tests/test-command-template.t
@@ -4177,7 +4177,7 @@ Test stringify on sub expressions
 
 Test splitlines
 
-  $ hg log -Gv -R a --template "{splitlines(desc) % 'foo {line}\n'}"
+  $ hg log -R a -Gv --template "{splitlines(desc) % 'foo {line}\n'}"
   @  foo Modify, add, remove, rename
   |
   o  foo future
@@ -4209,11 +4209,11 @@ Test splitlines
   line 1|line 2
 
 Test startswith
-  $ hg log -Gv -R a --template "{startswith(desc)}"
+  $ hg log -R a -Gv --template "{startswith(desc)}"
   hg: parse error: startswith expects two arguments
   [255]
 
-  $ hg log -Gv -R a --template "{startswith('line', desc)}"
+  $ hg log -R a -Gv --template "{startswith('line', desc)}"
   @
   |
   o
@@ -4239,13 +4239,13 @@ Test startswith
 
 Test bad template with better error message
 
-  $ hg log -Gv -R a --template '{desc|user()}'
+  $ hg log -R a -Gv --template '{desc|user()}'
   hg: parse error: expected a symbol, got 'func'
   [255]
 
 Test word function (including index out of bounds graceful failure)
 
-  $ hg log -Gv -R a --template "{word('1', desc)}"
+  $ hg log -R a -Gv --template "{word('1', desc)}"
   @  add,
   |
   o
@@ -4271,7 +4271,7 @@ Test word function (including index out 
 
 Test word third parameter used as splitter
 
-  $ hg log -Gv -R a --template "{word('0', desc, 'o')}"
+  $ hg log -R a -Gv --template "{word('0', desc, 'o')}"
   @  M
   |
   o  future
@@ -4297,11 +4297,11 @@ Test word third parameter used as splitt
 
 Test word error messages for not enough and too many arguments
 
-  $ hg log -Gv -R a --template "{word('0')}"
+  $ hg log -R a -Gv --template "{word('0')}"
   hg: parse error: word expects two or three arguments, got 1
   [255]
 
-  $ hg log -Gv -R a --template "{word('0', desc, 'o', 'h', 'b', 'o', 'y')}"
+  $ hg log -R a -Gv --template "{word('0', desc, 'o', 'h', 'b', 'o', 'y')}"
   hg: parse error: word expects two or three arguments, got 7
   [255]
 
@@ -4312,7 +4312,7 @@ Test word for integer literal
 
 Test word for invalid numbers
 
-  $ hg log -Gv -R a --template "{word('a', desc)}"
+  $ hg log -R a -Gv --template "{word('a', desc)}"
   hg: parse error: word expects an integer index
   [255]
 
@@ -4440,7 +4440,7 @@ Otherwise, our stock styles and web temp
   $ hg log -r0 -T '{rn} {utcdate(date)|isodate}\n'
   0:1e4e1b8f71e0 1970-01-12 13:46 +0000
 
-  $ hg log -r0 --config ui.logtemplate='"{rn} {utcdate(date)|isodate}\n"'
+  $ hg log --config ui.logtemplate='"{rn} {utcdate(date)|isodate}\n"' -r0
   0:1e4e1b8f71e0 1970-01-12 13:46 +0000
 
   $ cat <<EOF > tmpl
diff --git a/tests/test-commit-interactive.t b/tests/test-commit-interactive.t
--- a/tests/test-commit-interactive.t
+++ b/tests/test-commit-interactive.t
@@ -18,7 +18,7 @@ Select no files
   $ hg record --config ui.interactive=false
   abort: running non-interactively, use commit instead
   [255]
-  $ hg commit -i --config ui.interactive=false
+  $ hg commit --config ui.interactive=false -i
   abort: running non-interactively
   [255]
   $ hg commit -i empty-rw<<EOF
@@ -290,7 +290,7 @@ Modify end of plain file with username u
 
   $ echo 11 >> plain
   $ unset HGUSER
-  $ hg commit -i --config ui.username= -d '8 0' -m end plain
+  $ hg commit --config ui.username= -i -d '8 0' -m end plain
   abort: no username supplied
   (use 'hg config --edit' to set your username)
   [255]
@@ -300,7 +300,7 @@ Modify end of plain file, also test that
 
   $ HGUSER="test"
   $ export HGUSER
-  $ hg commit -i --config diff.showfunc=true -d '8 0' -m end plain <<EOF
+  $ hg commit --config diff.showfunc=true -i -d '8 0' -m end plain <<EOF
   > y
   > y
   > EOF
@@ -711,7 +711,7 @@ Add to beginning, middle, end
 
 Record beginning, middle, and test that format-breaking diffopts are ignored
 
-  $ hg commit -i --config diff.noprefix=True -d '14 0' -m middle-only plain <<EOF
+  $ hg commit --config diff.noprefix=True -i -d '14 0' -m middle-only plain <<EOF
   > y
   > y
   > y
@@ -1578,7 +1578,7 @@ Ignore win32text deprecation warning for
 Test --user when ui.username not set
   $ unset HGUSER
   $ echo e >> subdir/f1
-  $ hg commit -i  --config ui.username= -d '8 0' --user xyz -m "user flag" <<EOF
+  $ hg commit --config ui.username= -i -d '8 0' --user xyz -m "user flag" <<EOF
   > y
   > y
   > EOF
diff --git a/tests/test-convert-filemap.t b/tests/test-convert-filemap.t
--- a/tests/test-convert-filemap.t
+++ b/tests/test-convert-filemap.t
@@ -288,7 +288,7 @@ ensure that the filemap contains duplica
   $ hg -q convert --filemap renames.fmap --datesort source dummydest
   abort: data/dir/file3.i at e96dce0bc6a2: no match found!
   [255]
-  $ hg -q convert --filemap renames.fmap --datesort --config convert.hg.ignoreerrors=1 source renames.repo
+  $ hg -q convert --config convert.hg.ignoreerrors=1 --filemap renames.fmap --datesort source renames.repo
   ignoring: data/dir/file3.i at e96dce0bc6a2: no match found
   ignoring: data/dir/file4.i at 6edd55f559cd: no match found
   $ hg up -q -R renames.repo
diff --git a/tests/test-convert-svn-source.t b/tests/test-convert-svn-source.t
--- a/tests/test-convert-svn-source.t
+++ b/tests/test-convert-svn-source.t
@@ -164,7 +164,7 @@ Test filemap
   0 work in progress
   $ hg -R fmap branch -q
   default
-  $ hg log -G -R fmap --template '{rev} {desc|firstline} files: {files}\n'
+  $ hg log -R fmap -G --template '{rev} {desc|firstline} files: {files}\n'
   o  1 work in progress files: letter2.txt
   |
   o  0 second letter files: letter2.txt
diff --git a/tests/test-convert-svn-tags.t b/tests/test-convert-svn-tags.t
--- a/tests/test-convert-svn-tags.t
+++ b/tests/test-convert-svn-tags.t
@@ -48,7 +48,7 @@ Convert
 
 Convert without tags
 
-  $ hg convert --datesort --config convert.svn.tags= svn-repo A-notags-hg
+  $ hg convert --config convert.svn.tags= --datesort svn-repo A-notags-hg
   initializing destination A-notags-hg repository
   scanning source...
   sorting...
diff --git a/tests/test-copy.t b/tests/test-copy.t
--- a/tests/test-copy.t
+++ b/tests/test-copy.t
@@ -191,7 +191,7 @@ should show copy
 
 XXX: filtering lfilesrepo.status() in 3.3-rc causes the copy source to not be
 displayed.
-  $ hg st -C --config extensions.largefiles=
+  $ hg st --config extensions.largefiles= -C
   The fsmonitor extension is incompatible with the largefiles extension and has been disabled. (fsmonitor !)
   M bar
     foo
diff --git a/tests/test-diff-binary-file.t b/tests/test-diff-binary-file.t
--- a/tests/test-diff-binary-file.t
+++ b/tests/test-diff-binary-file.t
@@ -124,7 +124,7 @@ Test binary mode with extended git-style
   literal 5
   Mc${NkWMbw50018V5dZ)H
   
-  $ hg diff --git --binary --config diff.nobinary=True -r 0 -r 1
+  $ hg diff --config diff.nobinary=True --git --binary -r 0 -r 1
   diff --git a/binfile.bin b/binfile.bin
   index eaf36c1daccfdf325514461cd1a2ffbc139b5464..ba71a782e93f3fb63a428383706065e3ec2828e9
   GIT binary patch
diff --git a/tests/test-diff-color.t b/tests/test-diff-color.t
--- a/tests/test-diff-color.t
+++ b/tests/test-diff-color.t
@@ -53,7 +53,7 @@ default context
 
 (check that 'ui.color=yes' match '--color=auto')
 
-  $ hg diff --nodates --config ui.formatted=no
+  $ hg diff --config ui.formatted=no --nodates
   diff -r cf9f4ba66af2 a
   --- a/a
   +++ b/a
@@ -69,7 +69,7 @@ default context
 
 (check that 'ui.color=no' disable color)
 
-  $ hg diff --nodates --config ui.formatted=yes --config ui.color=no
+  $ hg diff --config ui.formatted=yes --config ui.color=no --nodates
   diff -r cf9f4ba66af2 a
   --- a/a
   +++ b/a
@@ -85,7 +85,7 @@ default context
 
 (check that 'ui.color=always' force color)
 
-  $ hg diff --nodates --config ui.formatted=no --config ui.color=always
+  $ hg diff --config ui.formatted=no --config ui.color=always --nodates
   \x1b[0;1mdiff -r cf9f4ba66af2 a\x1b[0m (esc)
   \x1b[0;31;1m--- a/a\x1b[0m (esc)
   \x1b[0;32;1m+++ b/a\x1b[0m (esc)
diff --git a/tests/test-diff-unified.t b/tests/test-diff-unified.t
--- a/tests/test-diff-unified.t
+++ b/tests/test-diff-unified.t
@@ -231,7 +231,7 @@ Git diff, adding space
 
 Git diff, adding extended headers
 
-  $ hg diff --git --config experimental.extendedheader.index=7 --config experimental.extendedheader.similarity=True
+  $ hg diff --config experimental.extendedheader.index=7 --config experimental.extendedheader.similarity=True --git
   diff --git a/f1 b/f 1
   similarity index 0%
   rename from f1
@@ -243,7 +243,7 @@ Git diff, adding extended headers
   -a
   +b
 
-  $ hg diff --git --config experimental.extendedheader.index=-1
+  $ hg diff --config experimental.extendedheader.index=-1 --git
   invalid length for extendedheader.index: '-1'
   diff --git a/f1 b/f 1
   rename from f1
@@ -254,7 +254,7 @@ Git diff, adding extended headers
   -a
   +b
 
-  $ hg diff --git --config experimental.extendedheader.index=whatever
+  $ hg diff --config experimental.extendedheader.index=whatever --git
   invalid value for extendedheader.index: 'whatever'
   diff --git a/f1 b/f 1
   rename from f1
@@ -371,7 +371,7 @@ showfunc diff
 
 If [diff] git is set to true, but the user says --no-git, we should
 *not* get git diffs
-  $ hg diff --nodates --config diff.git=1 --no-git
+  $ hg diff --config diff.git=1 --nodates --no-git
   diff -r f2c7c817fa55 f1
   --- a/f1
   +++ b/f1
diff --git a/tests/test-dispatch.t b/tests/test-dispatch.t
--- a/tests/test-dispatch.t
+++ b/tests/test-dispatch.t
@@ -62,61 +62,56 @@ Unparsable form of early options:
   abort: option --debugger may not be abbreviated and should come very first!
   [255]
 
-Parsing failure of early options should be detected before executing the
-command:
+Previously early options were parsed and the failure is detected before
+executing the command:
 
   $ hg log -b '--config=hooks.pre-log=false' default
-  abort: option --config may not be abbreviated!
+  abort: unknown revision '--config=hooks.pre-log=false'!
   [255]
   $ hg log -b -R. default
-  abort: option -R has to be separated from other options (e.g. not -qR) and --repository may only be abbreviated as --repo!
+  abort: unknown revision '-R.'!
   [255]
   $ hg log --cwd .. -b --cwd=. default
-  abort: option --cwd may not be abbreviated!
+  abort: no repository found in '$TESTTMP' (.hg not found)!
   [255]
 
-However, we can't prevent it from loading extensions and configs:
+Previously extensions and configs were loaded:
 
   $ cat <<EOF > bad.py
   > raise Exception('bad')
   > EOF
   $ hg log -b '--config=extensions.bad=bad.py' default
-  *** failed to import extension bad from bad.py: bad
-  abort: option --config may not be abbreviated!
+  abort: unknown revision '--config=extensions.bad=bad.py'!
   [255]
 
   $ mkdir -p badrepo/.hg
   $ echo 'invalid-syntax' > badrepo/.hg/hgrc
   $ hg log -b -Rbadrepo default
-  hg: parse error at badrepo/.hg/hgrc:1: invalid-syntax
+  abort: unknown revision '-Rbadrepo'!
   [255]
 
   $ hg log -b --cwd=inexistent default
-  abort: No such file or directory: 'inexistent'
+  abort: unknown revision '--cwd=inexistent'!
   [255]
 
   $ hg log -b '--config=ui.traceback=yes' 2>&1 | grep '^Traceback'
-  Traceback (most recent call last):
+  [1]
   $ hg log -b '--config=profiling.enabled=yes' 2>&1 | grep -i sample
-  Sample count: .*|No samples recorded\. (re)
-
-Early options can't be specified in [aliases] and [defaults] because they are
-applied before the command name is resolved:
+  [1]
 
   $ hg log -b '--config=alias.log=log --config=hooks.pre-log=false'
-  hg log: option -b not recognized
-  error in definition for alias 'log': --config may only be given on the command
-  line
+  abort: unknown revision '--config=alias.log=log --config=hooks.pre-log=false'!
   [255]
 
   $ hg log -b '--config=defaults.log=--config=hooks.pre-log=false'
-  abort: option --config may not be abbreviated!
+  abort: unknown revision '--config=defaults.log=--config=hooks.pre-log=false'!
   [255]
 
-Shell aliases bypass any command parsing rules but for the early one:
+Previously shell aliases were effective:
 
   $ hg log -b '--config=alias.log=!echo howdy'
-  howdy
+  abort: unknown revision '--config=alias.log=!echo howdy'!
+  [255]
 
 [defaults]
 
diff --git a/tests/test-editor-filename.t b/tests/test-editor-filename.t
--- a/tests/test-editor-filename.t
+++ b/tests/test-editor-filename.t
@@ -40,7 +40,7 @@ editor for a diff, the file ends in .dif
   $ hg add
   adding one
   adding two
-  $ hg commit --interactive --config ui.interactive=true --config ui.interface=text << EOF
+  $ hg commit --config ui.interactive=true --config ui.interface=text --interactive << EOF
   > y
   > e
   > q
diff --git a/tests/test-generaldelta.t b/tests/test-generaldelta.t
--- a/tests/test-generaldelta.t
+++ b/tests/test-generaldelta.t
@@ -79,7 +79,7 @@ Test "usegeneraldelta" config
 delta coming from the server base delta server are not recompressed.
 (also include the aggressive version for comparison)
 
-  $ hg clone repo --pull --config format.usegeneraldelta=1 usegd
+  $ hg clone repo --config format.usegeneraldelta=1 --pull usegd
   requesting all changes
   adding changesets
   adding manifests
@@ -88,7 +88,7 @@ delta coming from the server base delta 
   new changesets 0ea3fcf9d01d:bba78d330d9c
   updating to branch default
   3 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  $ hg clone repo --pull --config format.generaldelta=1 full
+  $ hg clone repo --config format.generaldelta=1 --pull full
   requesting all changes
   adding changesets
   adding manifests
diff --git a/tests/test-globalopts.t b/tests/test-globalopts.t
--- a/tests/test-globalopts.t
+++ b/tests/test-globalopts.t
@@ -134,22 +134,22 @@ earlygetopt short option without followi
 earlygetopt with illegal abbreviations:
 
   $ hg --confi "foo.bar=baz"
-  abort: option --config may not be abbreviated!
+  abort: option --config may not be abbreviated and should come very first!
   [255]
   $ hg --cw a tip
-  abort: option --cwd may not be abbreviated!
+  abort: option --cwd may not be abbreviated and should come very first!
   [255]
   $ hg --rep a tip
-  abort: option -R has to be separated from other options (e.g. not -qR) and --repository may only be abbreviated as --repo!
+  abort: option -R has to be separated from other options (e.g. not -qR), --repository may only be abbreviated as --repo, and the option should come very first!
   [255]
   $ hg --repositor a tip
-  abort: option -R has to be separated from other options (e.g. not -qR) and --repository may only be abbreviated as --repo!
+  abort: option -R has to be separated from other options (e.g. not -qR), --repository may only be abbreviated as --repo, and the option should come very first!
   [255]
   $ hg -qR a tip
-  abort: option -R has to be separated from other options (e.g. not -qR) and --repository may only be abbreviated as --repo!
+  abort: option -R has to be separated from other options (e.g. not -qR), --repository may only be abbreviated as --repo, and the option should come very first!
   [255]
   $ hg -qRa tip
-  abort: option -R has to be separated from other options (e.g. not -qR) and --repository may only be abbreviated as --repo!
+  abort: option -R has to be separated from other options (e.g. not -qR), --repository may only be abbreviated as --repo, and the option should come very first!
   [255]
 
 Testing --cwd:
diff --git a/tests/test-hgignore.t b/tests/test-hgignore.t
--- a/tests/test-hgignore.t
+++ b/tests/test-hgignore.t
@@ -241,7 +241,7 @@ Check recursive glob pattern matches no 
 
 Check using 'include:' in ignore file
 
-  $ hg purge --all --config extensions.purge=
+  $ hg purge --config extensions.purge= --all
   $ touch foo.included
 
   $ echo ".*.included" > otherignore
@@ -280,7 +280,7 @@ Check using 'include:' while in a non-ro
 Check including subincludes
 
   $ hg revert -q --all
-  $ hg purge --all --config extensions.purge=
+  $ hg purge --config extensions.purge= --all
   $ echo ".hgignore" > .hgignore
   $ mkdir dir1 dir2
   $ touch dir1/file1 dir1/file2 dir2/file1 dir2/file2
diff --git a/tests/test-histedit-obsolete.t b/tests/test-histedit-obsolete.t
--- a/tests/test-histedit-obsolete.t
+++ b/tests/test-histedit-obsolete.t
@@ -545,7 +545,7 @@ attempted later.
   |
   o  0:cb9a9f314b8b (public) a
   
-  $ hg histedit -r 'b449568bf7fc' --commands - << EOF --config experimental.evolution.track-operation=1
+  $ hg histedit --config experimental.evolution.track-operation=1 -r 'b449568bf7fc' --commands - << EOF
   > pick b449568bf7fc 13 f
   > pick 7395e1ff83bd 15 h
   > pick 6b70183d2492 14 g
@@ -556,7 +556,7 @@ attempted later.
   Editing (ee118ab9fa44), you may commit or record as needed now.
   (hg histedit --continue to resume)
   [1]
-  $ hg histedit --continue --config experimental.evolution.track-operation=1
+  $ hg histedit --config experimental.evolution.track-operation=1 --continue
   $ hg log -G
   @  23:175d6b286a22 (secret) k
   |
diff --git a/tests/test-https.t b/tests/test-https.t
--- a/tests/test-https.t
+++ b/tests/test-https.t
@@ -380,7 +380,7 @@ Changing the cipher string works
 Fingerprints
 
 - works without cacerts (hostfingerprints)
-  $ hg -R copy-pull id https://localhost:$HGPORT/ --insecure --config hostfingerprints.localhost=ec:d8:7c:d6:b3:86:d0:4f:c1:b8:b4:1c:9d:8f:5e:16:8e:ef:1c:03
+  $ hg -R copy-pull --config hostfingerprints.localhost=ec:d8:7c:d6:b3:86:d0:4f:c1:b8:b4:1c:9d:8f:5e:16:8e:ef:1c:03 id https://localhost:$HGPORT/ --insecure
   warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?)
   (SHA-1 fingerprint for localhost found in legacy [hostfingerprints] section; if you trust this fingerprint, remove the old SHA-1 fingerprint from [hostfingerprints] and add the following entry to the new [hostsecurity] section: localhost:fingerprints=sha256:20:de:b3:ad:b4:cd:a5:42:f0:74:41:1c:a2:70:1e:da:6e:c0:5c:16:9e:e7:22:0f:f1:b7:e5:6e:e4:92:af:7e)
   5fed3813f7f5
diff --git a/tests/test-largefiles-cache.t b/tests/test-largefiles-cache.t
--- a/tests/test-largefiles-cache.t
+++ b/tests/test-largefiles-cache.t
@@ -192,7 +192,7 @@ conditional above.
 
 Verify that backwards compatibility is maintained for old storage layout
   $ mv src/.hg/largefiles/$hash share_dst/.hg/largefiles
-  $ hg verify --quiet --lfa -R share_dst --config largefiles.usercache=
+  $ hg verify -R share_dst --config largefiles.usercache= --quiet --lfa
 
 Inject corruption into the largefiles store and see how update handles that:
 
@@ -225,7 +225,7 @@ Test coverage of error handling from put
   $ hg serve -R ../mirror -d -p $HGPORT1 --pid-file hg.pid --config largefiles.usercache=$TESTTMP/mirrorcache
   $ cat hg.pid >> $DAEMON_PIDS
 
-  $ hg push http://localhost:$HGPORT1 -f --config files.usercache=nocache
+  $ hg push --config files.usercache=nocache http://localhost:$HGPORT1 -f
   pushing to http://localhost:$HGPORT1/
   searching for changes
   abort: remotestore: could not open file $TESTTMP/src/.hg/largefiles/e2fb5f2139d086ded2cb600d5a91a196e76bf020: HTTP Error 403: ssl required (glob)
@@ -238,7 +238,7 @@ Test coverage of 'missing from store':
   $ hg serve -R ../mirror -d -p $HGPORT2 --pid-file hg.pid --config largefiles.usercache=$TESTTMP/mirrorcache --config "web.allow_push=*" --config web.push_ssl=no
   $ cat hg.pid >> $DAEMON_PIDS
 
-  $ hg push http://localhost:$HGPORT2 -f --config largefiles.usercache=nocache
+  $ hg push --config largefiles.usercache=nocache http://localhost:$HGPORT2 -f
   pushing to http://localhost:$HGPORT2/
   searching for changes
   abort: largefile e2fb5f2139d086ded2cb600d5a91a196e76bf020 missing from store (needs to be uploaded)
@@ -246,13 +246,13 @@ Test coverage of 'missing from store':
 
 Verify that --lfrev controls which revisions are checked for largefiles to push
 
-  $ hg push http://localhost:$HGPORT2 -f --config largefiles.usercache=nocache --lfrev tip
+  $ hg push --config largefiles.usercache=nocache http://localhost:$HGPORT2 -f --lfrev tip
   pushing to http://localhost:$HGPORT2/
   searching for changes
   abort: largefile e2fb5f2139d086ded2cb600d5a91a196e76bf020 missing from store (needs to be uploaded)
   [255]
 
-  $ hg push http://localhost:$HGPORT2 -f --config largefiles.usercache=nocache --lfrev null
+  $ hg push --config largefiles.usercache=nocache http://localhost:$HGPORT2 -f --lfrev null
   pushing to http://localhost:$HGPORT2/
   searching for changes
   remote: adding changesets
diff --git a/tests/test-largefiles-misc.t b/tests/test-largefiles-misc.t
--- a/tests/test-largefiles-misc.t
+++ b/tests/test-largefiles-misc.t
@@ -1076,7 +1076,7 @@ largefiles (issue4547)
   $ hg -R subrepo-root status -S
   M large
   M no-largefiles/normal1
-  $ hg -R subrepo-root extdiff -p echo -S --config extensions.extdiff=
+  $ hg -R subrepo-root --config extensions.extdiff= extdiff -p echo -S
   "*\\no-largefiles\\normal1" "*\\no-largefiles\\normal1" (glob) (windows !)
   */no-largefiles/normal1 */no-largefiles/normal1 (glob) (no-windows !)
   [1]
diff --git a/tests/test-largefiles-update.t b/tests/test-largefiles-update.t
--- a/tests/test-largefiles-update.t
+++ b/tests/test-largefiles-update.t
@@ -451,7 +451,7 @@ Test that the internal linear merging wo
 
   $ echo 'large1 for linear merge (conflict)' > large1
   $ echo 'large2 for linear merge (conflict with normal file)' > large2
-  $ hg pull --update --config debug.dirstate.delaywrite=2 $TESTTMP/9530e27857f7-2e7b195d-backup.hg
+  $ hg pull --config debug.dirstate.delaywrite=2 --update $TESTTMP/9530e27857f7-2e7b195d-backup.hg
   pulling from $TESTTMP/9530e27857f7-2e7b195d-backup.hg (glob)
   searching for changes
   adding changesets
@@ -489,7 +489,7 @@ Test that the internal linear merging wo
 
   $ echo 'large1 for linear merge (conflict)' > large1
   $ echo 'large2 for linear merge (conflict with normal file)' > large2
-  $ hg unbundle --update --config debug.dirstate.delaywrite=2 $TESTTMP/9530e27857f7-2e7b195d-backup.hg
+  $ hg unbundle --config debug.dirstate.delaywrite=2 --update $TESTTMP/9530e27857f7-2e7b195d-backup.hg
   adding changesets
   adding manifests
   adding file changes
@@ -583,7 +583,7 @@ it is aborted by conflict.
   e5bb990443d6a92aaf7223813720f7566c9dd05b
   $ cat large1
   large1 in #3
-  $ hg rebase -s 1 -d 3 --keep --config ui.interactive=True <<EOF
+  $ hg rebase --config ui.interactive=True -s 1 -d 3 --keep <<EOF
   > o
   > EOF
   rebasing 1:72518492caa6 "#1"
@@ -608,7 +608,7 @@ the 1st commit of resuming.
   $ hg resolve -m normal1
   (no more unresolved files)
   continue: hg rebase --continue
-  $ hg rebase --continue --config ui.interactive=True <<EOF
+  $ hg rebase --config ui.interactive=True --continue <<EOF
   > c
   > EOF
   rebasing 1:72518492caa6 "#1"
diff --git a/tests/test-largefiles.t b/tests/test-largefiles.t
--- a/tests/test-largefiles.t
+++ b/tests/test-largefiles.t
@@ -1097,7 +1097,7 @@ downloaded from 'default' instead of 'de
   4 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ rm "${USERCACHE}"/*
   $ cd a-backup
-  $ hg pull --all-largefiles --config paths.default-push=bogus/path
+  $ hg pull --config paths.default-push=bogus/path --all-largefiles
   pulling from $TESTTMP/a (glob)
   searching for changes
   adding changesets
@@ -1198,7 +1198,7 @@ Largefiles are fetched for the new pulle
 rebased or not.
 
   $ [ ! -f .hg/largefiles/e166e74c7303192238d60af5a9c4ce9bef0b7928 ]
-  $ hg pull --rebase --all-largefiles --config paths.default-push=bogus/path --config paths.default=../b
+  $ hg pull --config paths.default-push=bogus/path --config paths.default=../b --rebase --all-largefiles
   pulling from $TESTTMP/b (glob)
   searching for changes
   adding changesets
diff --git a/tests/test-log-exthook.t b/tests/test-log-exthook.t
--- a/tests/test-log-exthook.t
+++ b/tests/test-log-exthook.t
@@ -44,7 +44,7 @@ Check the log
   
 Check that exthook is working with graph log too
 
-  $ hg log -G --config extensions.t=$TESTTMP/logexthook.py
+  $ hg log --config extensions.t=$TESTTMP/logexthook.py -G
   @  changeset:   1:70fc82b23320
   |  tag:         tip
   |  user:        test
diff --git a/tests/test-log-linerange.t b/tests/test-log-linerange.t
--- a/tests/test-log-linerange.t
+++ b/tests/test-log-linerange.t
@@ -234,7 +234,7 @@ With --template.
 
 With some white-space diff option, respective revisions are skipped.
 
-  $ hg log -f -L foo,5:7 -p --config diff.ignorews=true
+  $ hg log --config diff.ignorews=true -f -L foo,5:7 -p
   changeset:   5:cfdf972b3971
   tag:         tip
   user:        test
@@ -818,7 +818,7 @@ Binary files work but without diff hunks
   Wc$_QA$SmdpqC~Ew%)G>+N(KNlNClYy
   
   
-  $ hg log -f -L binary,1:2 -p --config diff.git=false
+  $ hg log --config diff.git=false -f -L binary,1:2 -p
   changeset:   10:c96381c229df
   tag:         tip
   user:        test
diff --git a/tests/test-log.t b/tests/test-log.t
--- a/tests/test-log.t
+++ b/tests/test-log.t
@@ -1356,7 +1356,7 @@ Test that all log names are translated (
 log -p --cwd dir (in subdir)
 
   $ mkdir dir
-  $ hg log -p --cwd dir
+  $ hg log --cwd dir -p
   changeset:   3:f5d8de11c2e2
   branch:      test
   tag:         tip
@@ -1411,7 +1411,7 @@ log -p --cwd dir (in subdir)
 log -p -R repo
 
   $ cd dir
-  $ hg log -p -R .. ../a
+  $ hg log -R .. -p ../a
   changeset:   0:24427303d56f
   user:        test
   date:        Thu Jan 01 00:00:00 1970 +0000
diff --git a/tests/test-merge-changedelete.t b/tests/test-merge-changedelete.t
--- a/tests/test-merge-changedelete.t
+++ b/tests/test-merge-changedelete.t
@@ -656,7 +656,7 @@ invocations.)
   >         echo "=== :$lasttool -> :$tool ==="
   >         ref="$TESTTMP/$tool.status"
   >         hg resolve --unmark --all
-  >         hg resolve --tool ":$tool" --all --config ui.interactive=True
+  >         hg resolve --config ui.interactive=True --tool ":$tool" --all
   >         status > "$TESTTMP/compare.status" 2>&1
   >         echo '--- diff of status ---'
   >         if cmp "$TESTTMP/$tool.status" "$TESTTMP/compare.status" || diff -U8 "$TESTTMP/$tool.status" "$TESTTMP/compare.status"; then
diff --git a/tests/test-merge-halt.t b/tests/test-merge-halt.t
--- a/tests/test-merge-halt.t
+++ b/tests/test-merge-halt.t
@@ -156,7 +156,7 @@ Check that always-prompt also can halt t
   rebase aborted
 
 Check that successful tool otherwise allows the merge to continue
-  $ hg rebase -s 1 -d 2 --tool echo --keep --config merge-tools.echo.premerge=keep
+  $ hg rebase --config merge-tools.echo.premerge=keep -s 1 -d 2 --tool echo --keep
   rebasing 1:1f28a51c3c9b "c"
   merging a
   merging b
diff --git a/tests/test-merge-tools.t b/tests/test-merge-tools.t
--- a/tests/test-merge-tools.t
+++ b/tests/test-merge-tools.t
@@ -589,7 +589,7 @@ prompt with EOF
   M f
   # hg resolve --list
   U f
-  $ hg resolve --all --config ui.merge=internal:prompt --config ui.interactive=true
+  $ hg resolve --config ui.merge=internal:prompt --config ui.interactive=true --all
   keep (l)ocal [working copy], take (o)ther [merge rev], or leave (u)nresolved for f? 
   [1]
   $ aftermerge
@@ -602,7 +602,7 @@ prompt with EOF
   # hg resolve --list
   U f
   $ rm f
-  $ hg resolve --all --config ui.merge=internal:prompt --config ui.interactive=true
+  $ hg resolve --config ui.merge=internal:prompt --config ui.interactive=true --all
   keep (l)ocal [working copy], take (o)ther [merge rev], or leave (u)nresolved for f? 
   [1]
   $ aftermerge
@@ -613,7 +613,7 @@ prompt with EOF
   M f
   # hg resolve --list
   U f
-  $ hg resolve --all --config ui.merge=internal:prompt
+  $ hg resolve --config ui.merge=internal:prompt --all
   keep (l)ocal [working copy], take (o)ther [merge rev], or leave (u)nresolved for f? u
   [1]
   $ aftermerge
diff --git a/tests/test-mq-qpush-fail.t b/tests/test-mq-qpush-fail.t
--- a/tests/test-mq-qpush-fail.t
+++ b/tests/test-mq-qpush-fail.t
@@ -51,7 +51,7 @@ test qpush on empty series
   > def extsetup(ui):
   >     extensions.wrapfunction(transaction, '_playback', wrapplayback)
   > EOF
-  $ hg qpush -a --config extensions.wrapplayback=$TESTTMP/wrapplayback.py  && echo 'qpush succeeded?!'
+  $ hg qpush --config extensions.wrapplayback=$TESTTMP/wrapplayback.py -a && echo 'qpush succeeded?!'
   applying patch1
   applying patch2
   applying bad-patch
@@ -445,7 +445,7 @@ test mq.keepchanges setting
   $ hg st a
   M a
   $ echo b >> b
-  $ hg --config mq.keepchanges=1 qpop --force --config 'ui.origbackuppath=.hg/origbackups'
+  $ hg --config mq.keepchanges=1 --config 'ui.origbackuppath=.hg/origbackups' qpop --force
   popping p3
   now at: p2
   $ hg st b
diff --git a/tests/test-mq-qrefresh-interactive.t b/tests/test-mq-qrefresh-interactive.t
--- a/tests/test-mq-qrefresh-interactive.t
+++ b/tests/test-mq-qrefresh-interactive.t
@@ -126,7 +126,7 @@ Base commit
   $ hg qrecord --config ui.interactive=false patch
   abort: running non-interactively, use qnew instead
   [255]
-  $ hg qnew -i --config ui.interactive=false patch
+  $ hg qnew --config ui.interactive=false patch -i
   abort: running non-interactively
   [255]
   $ hg qnew -d '0 0' patch
@@ -177,7 +177,7 @@ Whole diff
 
 partial qrefresh
 
-  $ hg qrefresh -i --config ui.interactive=false
+  $ hg qrefresh --config ui.interactive=false -i
   abort: running non-interactively
   [255]
   $ hg qrefresh -i -d '0 0' <<EOF
diff --git a/tests/test-obsmarker-template.t b/tests/test-obsmarker-template.t
--- a/tests/test-obsmarker-template.t
+++ b/tests/test-obsmarker-template.t
@@ -106,7 +106,7 @@ Predecessors template should show curren
   o  ea207398892e
   
 
-  $ hg log -G --config ui.logtemplate=
+  $ hg log --config ui.logtemplate= -G
   o  changeset:   3:d004c8f274b9
   |  tag:         tip
   |  parent:      0:ea207398892e
diff --git a/tests/test-obsolete-bundle-strip.t b/tests/test-obsolete-bundle-strip.t
--- a/tests/test-obsolete-bundle-strip.t
+++ b/tests/test-obsolete-bundle-strip.t
@@ -606,7 +606,7 @@ setup
 
 (it is annoying to create prune with parent data without the changeset, so we strip it after the fact)
 
-  $ hg strip --hidden --rev 'desc("C-A0")::' --no-backup --config devel.strip-obsmarkers=no
+  $ hg strip --config devel.strip-obsmarkers=no --hidden --rev 'desc("C-A0")::' --no-backup
 
   $ hg up 'desc("ROOT")'
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
@@ -686,7 +686,7 @@ setup
 
 (it is annoying to create prune with parent data without the changeset, so we strip it after the fact)
 
-  $ hg strip --hidden --rev 'desc("C-A0")::' --no-backup --config devel.strip-obsmarkers=no
+  $ hg strip --config devel.strip-obsmarkers=no --hidden --rev 'desc("C-A0")::' --no-backup
 
   $ hg up 'desc("ROOT")'
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
diff --git a/tests/test-obsolete.t b/tests/test-obsolete.t
--- a/tests/test-obsolete.t
+++ b/tests/test-obsolete.t
@@ -1039,7 +1039,7 @@ This test issue 3805
   |
   o  0:d20a80d4def3 (draft) [ ] base
   
-  $ hg log -G -R ../repo-issue3805
+  $ hg log -R ../repo-issue3805 -G
   @  2:323a9c3ddd91 (draft) [tip ] A
   |
   o  0:d20a80d4def3 (draft) [ ] base
@@ -1166,7 +1166,7 @@ Test bundle overlay onto hidden revision
   searching for changes
   1:44526ebb0f98 (draft) [ ] B
   2:c186d7714947 (draft) [tip ] C
-  $ hg log -G -R ../bundleoverlay.hg
+  $ hg log -R ../bundleoverlay.hg -G
   o  3:c186d7714947 (draft) [tip ] C
   |
   | @  2:b7d587542d40 (draft) [ ] B+
@@ -1312,7 +1312,7 @@ Test ability to pull changeset with loca
   $ hg ci -m '2'
 
   $ echo bar > f2
-  $ hg commit --amend --config experimental.evolution.createmarkers=True
+  $ hg commit --config experimental.evolution.createmarkers=True --amend
   $ hg log -G
   @  3:b0551702f918 (draft) [tip ] 2
   |
diff --git a/tests/test-pathconflicts-update.t b/tests/test-pathconflicts-update.t
--- a/tests/test-pathconflicts-update.t
+++ b/tests/test-pathconflicts-update.t
@@ -152,7 +152,7 @@ Update clean - local directory conflicts
   $ rm a/b
   $ mkdir a/b
   $ echo 9 > a/b/c
-  $ hg up file2 --check --config merge.checkunknown=warn
+  $ hg up --config merge.checkunknown=warn file2 --check
   abort: uncommitted changes
   [255]
   $ hg up file2 --clean
diff --git a/tests/test-push-warn.t b/tests/test-push-warn.t
--- a/tests/test-push-warn.t
+++ b/tests/test-push-warn.t
@@ -573,7 +573,7 @@ glog of local:
   
 glog of remote:
 
-  $ hg log -G -R inner --template "{rev}: {branches} {desc}\n"
+  $ hg log -R inner -G --template "{rev}: {branches} {desc}\n"
   @  2: B b1
   |
   o  1: B b
@@ -657,7 +657,7 @@ glog of local:
   
 glog of remote:
 
-  $ hg log -G -R inner --template "{rev}: {branches} {desc}\n"
+  $ hg log -R inner -G --template "{rev}: {branches} {desc}\n"
   @  3: B b1
   |
   | o  2: A a1
@@ -743,7 +743,7 @@ glog of local:
   
 glog of remote:
 
-  $ hg log -G -R inner --template "{rev}: {branches} {desc}\n"
+  $ hg log -R inner -G --template "{rev}: {branches} {desc}\n"
   @  3: B b1
   |
   o  2: B b0
diff --git a/tests/test-rebase-conflicts.t b/tests/test-rebase-conflicts.t
--- a/tests/test-rebase-conflicts.t
+++ b/tests/test-rebase-conflicts.t
@@ -408,7 +408,7 @@ Test rebase with obsstore turned on and 
   $ hg resolve -m
   (no more unresolved files)
   continue: hg rebase --continue
-  $ hg rebase --continue --config experimental.evolution=none
+  $ hg rebase --config experimental.evolution=none --continue
   rebasing 1:112478962961 "B" (B)
   rebasing 3:f585351a92f8 "D" (D)
   warning: orphaned descendants detected, not stripping 112478962961
diff --git a/tests/test-rebase-detach.t b/tests/test-rebase-detach.t
--- a/tests/test-rebase-detach.t
+++ b/tests/test-rebase-detach.t
@@ -247,7 +247,7 @@ Verify that target is not selected as ex
   |/
   o  0: 'A'
   
-  $ hg rebase -s I -d H --collapse --config ui.merge=internal:other
+  $ hg rebase --config ui.merge=internal:other -s I -d H --collapse
   rebasing 5:b92d164ad3cb "I" (I)
   rebasing 6:0cfbc7e8faaf "Merge"
   rebasing 7:c6aaf0d259c0 "J" (tip)
diff --git a/tests/test-rebase-scenario-global.t b/tests/test-rebase-scenario-global.t
--- a/tests/test-rebase-scenario-global.t
+++ b/tests/test-rebase-scenario-global.t
@@ -54,7 +54,7 @@ can abort or warn for colliding untracke
   $ hg status --rev "3^1" --rev 3
   A D
   $ echo collide > D
-  $ HGEDITOR=cat hg rebase -s 3 -d 7 --edit --config merge.checkunknown=warn
+  $ HGEDITOR=cat hg rebase --config merge.checkunknown=warn -s 3 -d 7 --edit
   rebasing 3:32af7686d403 "D"
   D: replacing untracked file
   D
diff --git a/tests/test-revert.t b/tests/test-revert.t
--- a/tests/test-revert.t
+++ b/tests/test-revert.t
@@ -387,7 +387,7 @@ remove any pending change
   forgetting allyour
   forgetting base
   undeleting ignored
-  $ hg purge --all --config extensions.purge=
+  $ hg purge --config extensions.purge= --all
 
 Adds a new commit
 
diff --git a/tests/test-setdiscovery.t b/tests/test-setdiscovery.t
--- a/tests/test-setdiscovery.t
+++ b/tests/test-setdiscovery.t
@@ -400,14 +400,14 @@ fixed in 86c35b7ae300:
   > unrandomsample = $TESTTMP/unrandomsample.py
   > EOF
 
-  $ hg -R r1 outgoing r2 -T'{rev} ' --config extensions.blackbox=
+  $ hg -R r1 outgoing --config extensions.blackbox= r2 -T'{rev} '
   comparing with r2
   searching for changes
   101 102 103 104 105 106 107 108 109 110  (no-eol)
   $ hg -R r1 --config extensions.blackbox= blackbox
   * @5d0b986a083e0d91f116de4691e2aaa54d5bbec0 (*)> serve --cmdserver chgunix * (glob) (chg !)
-  * @5d0b986a083e0d91f116de4691e2aaa54d5bbec0 (*)> -R r1 outgoing r2 *-T{rev} * --config *extensions.blackbox=* (glob)
+  * @5d0b986a083e0d91f116de4691e2aaa54d5bbec0 (*)> -R r1 outgoing --config *extensions.blackbox=* r2 *-T{rev} * (glob)
   * @5d0b986a083e0d91f116de4691e2aaa54d5bbec0 (*)> found 101 common and 1 unknown server heads, 2 roundtrips in *.????s (glob)
-  * @5d0b986a083e0d91f116de4691e2aaa54d5bbec0 (*)> -R r1 outgoing r2 *-T{rev} * --config *extensions.blackbox=* exited 0 after *.?? seconds (glob)
+  * @5d0b986a083e0d91f116de4691e2aaa54d5bbec0 (*)> -R r1 outgoing --config *extensions.blackbox=* r2 *-T{rev} * exited 0 after *.?? seconds (glob)
   * @5d0b986a083e0d91f116de4691e2aaa54d5bbec0 (*)> -R r1 --config *extensions.blackbox=* blackbox (glob)
   $ cd ..
diff --git a/tests/test-shelve.t b/tests/test-shelve.t
--- a/tests/test-shelve.t
+++ b/tests/test-shelve.t
@@ -952,7 +952,7 @@ Test interactive shelve
   $ cat foo/foo
   foo
   a
-  $ hg shelve --interactive --config ui.interactive=false
+  $ hg shelve --config ui.interactive=false --interactive
   abort: running non-interactively
   [255]
   $ hg shelve --interactive << EOF
diff --git a/tests/test-sparse-requirement.t b/tests/test-sparse-requirement.t
--- a/tests/test-sparse-requirement.t
+++ b/tests/test-sparse-requirement.t
@@ -46,7 +46,7 @@ Client without sparse enabled reacts pro
 
 Requirement for sparse is removed when sparse is disabled
 
-  $ hg debugsparse --reset --config extensions.sparse=
+  $ hg debugsparse --config extensions.sparse= --reset
 
   $ cat .hg/requires
   dotencode
diff --git a/tests/test-sparse.t b/tests/test-sparse.t
--- a/tests/test-sparse.t
+++ b/tests/test-sparse.t
@@ -172,7 +172,7 @@ Verify adding sparseness hides files
 
   $ hg up -qC .
 TODO: add an option to purge to also purge files outside the sparse config?
-  $ hg purge --all --config extensions.purge=
+  $ hg purge --config extensions.purge= --all
   $ ls
   hide
   hide3
@@ -207,7 +207,7 @@ Verify rebase temporarily includes exclu
 
 Verify aborting a rebase cleans up temporary files
 
-  $ hg rebase --abort --config extensions.rebase=
+  $ hg rebase --config extensions.rebase= --abort
   cleaned up 1 temporarily added file(s) from the sparse checkout
   rebase aborted
   $ rm hide.orig
diff --git a/tests/test-subrepo-deep-nested-change.t b/tests/test-subrepo-deep-nested-change.t
--- a/tests/test-subrepo-deep-nested-change.t
+++ b/tests/test-subrepo-deep-nested-change.t
@@ -121,12 +121,12 @@ are also available as siblings of 'main'
 
 Cleaning both repositories, just as a clone -U
 
-  $ hg up -C -R sub2 null
+  $ hg up -R sub2 -C null
   \r (no-eol) (esc)
   updating [===========================================>] 1/1\r (no-eol) (esc)
                                                               \r (no-eol) (esc)
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
-  $ hg up -C -R sub1 null
+  $ hg up -R sub1 -C null
   \r (no-eol) (esc)
   updating [===========================================>] 1/1\r (no-eol) (esc)
                                                               \r (no-eol) (esc)
@@ -134,7 +134,7 @@ Cleaning both repositories, just as a cl
   updating [===========================================>] 3/3\r (no-eol) (esc)
                                                               \r (no-eol) (esc)
   0 files updated, 0 files merged, 3 files removed, 0 files unresolved
-  $ hg up -C -R main null
+  $ hg up -R main -C null
   \r (no-eol) (esc)
   updating [===========================================>] 1/1\r (no-eol) (esc)
                                                               \r (no-eol) (esc)
@@ -681,7 +681,7 @@ subrepos are archived properly.
 Note that add --large through a subrepo currently adds the file as a normal file
 
   $ echo "large" > sub1/sub2/large.bin
-  $ hg --config extensions.largefiles= add --large -R sub1/sub2 sub1/sub2/large.bin
+  $ hg --config extensions.largefiles= -R sub1/sub2 add --large sub1/sub2/large.bin
   $ echo "large" > large.bin
   $ hg --config extensions.largefiles= add --large large.bin
   $ hg --config extensions.largefiles= ci -S -m "add large files"
diff --git a/tests/test-subrepo-missing.t b/tests/test-subrepo-missing.t
--- a/tests/test-subrepo-missing.t
+++ b/tests/test-subrepo-missing.t
@@ -23,7 +23,7 @@ abort more gracefully on .hgsubstate par
 
   $ cp .hgsubstate .hgsubstate.old
   >>> file('.hgsubstate', 'wb').write('\ninvalid')
-  $ hg st --subrepos --cwd $TESTTMP -R $TESTTMP/repo
+  $ hg st --cwd $TESTTMP -R $TESTTMP/repo --subrepos
   abort: invalid subrepository revision specifier in 'repo/.hgsubstate' line 2
   [255]
   $ mv .hgsubstate.old .hgsubstate
diff --git a/tests/test-subrepo-relative-path.t b/tests/test-subrepo-relative-path.t
--- a/tests/test-subrepo-relative-path.t
+++ b/tests/test-subrepo-relative-path.t
@@ -23,9 +23,9 @@ Preparing the 'main' repo which depends 
 
 Cleaning both repositories, just as a clone -U
 
-  $ hg up -C -R sub null
+  $ hg up -R sub -C null
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
-  $ hg up -C -R main null
+  $ hg up -R main -C null
   0 files updated, 0 files merged, 3 files removed, 0 files unresolved
   $ rm -rf main/sub
 
diff --git a/tests/test-subrepo.t b/tests/test-subrepo.t
--- a/tests/test-subrepo.t
+++ b/tests/test-subrepo.t
@@ -113,7 +113,7 @@ commands that require a clean repo shoul
   $ hg backout tip
   abort: uncommitted changes in subrepository "s"
   [255]
-  $ hg revert -C -R s s/a
+  $ hg revert -R s -C s/a
 
 add sub sub
 
@@ -1643,14 +1643,14 @@ configuration
   > new-commit = draft
   > EOF
   $ echo phasecheck1 >> s/ss/a
-  $ hg -R s commit -S --config phases.checksubrepos=abort -m phasecheck1
+  $ hg -R s commit --config phases.checksubrepos=abort -S -m phasecheck1
   committing subrepository ss
   transaction abort!
   rollback completed
   abort: can't commit in draft phase conflicting secret from subrepository ss
   [255]
   $ echo phasecheck2 >> s/ss/a
-  $ hg -R s commit -S --config phases.checksubrepos=ignore -m phasecheck2
+  $ hg -R s commit --config phases.checksubrepos=ignore -S -m phasecheck2
   committing subrepository ss
   $ hg -R s/ss phase tip
   3: secret
diff --git a/tests/test-url-rev.t b/tests/test-url-rev.t
--- a/tests/test-url-rev.t
+++ b/tests/test-url-rev.t
@@ -96,7 +96,7 @@ Changing original repo:
   $ hg -q outgoing '../clone'
   2:faba9097cad4
   3:4cd725637392
-  $ hg summary --remote --config paths.default='../clone'
+  $ hg summary --config paths.default='../clone' --remote
   parent: 3:4cd725637392 tip
    add bar
   branch: default
@@ -106,7 +106,7 @@ Changing original repo:
   remote: 2 outgoing
   $ hg -q outgoing '../clone#foo'
   2:faba9097cad4
-  $ hg summary --remote --config paths.default='../clone#foo'
+  $ hg summary --config paths.default='../clone#foo' --remote
   parent: 3:4cd725637392 tip
    add bar
   branch: default
@@ -117,7 +117,7 @@ Changing original repo:
 
   $ hg -q --cwd ../clone incoming '../repo#foo'
   2:faba9097cad4
-  $ hg --cwd ../clone summary --remote --config paths.default='../repo#foo'
+  $ hg --cwd ../clone summary --config paths.default='../repo#foo' --remote
   parent: 1:cd2a86ecc814 tip
    change a
   branch: foo
@@ -142,7 +142,7 @@ Changing original repo:
   
   $ hg -q --cwd ../clone incoming '../repo#foo'
   [1]
-  $ hg --cwd ../clone summary --remote --config paths.default='../repo#foo'
+  $ hg --cwd ../clone summary --config paths.default='../repo#foo' --remote
   parent: 1:cd2a86ecc814 
    change a
   branch: foo
@@ -279,7 +279,7 @@ Test handling common incoming revisions 
   2:faba9097cad4
   4:d515801a8f3d
 
-  $ hg summary --remote --config paths.default='../clone#default' --config paths.default-push='../clone#foo'
+  $ hg summary --config paths.default='../clone#default' --config paths.default-push='../clone#foo' --remote
   parent: 4:d515801a8f3d tip
    new head to push current default head
   branch: default
@@ -288,7 +288,7 @@ Test handling common incoming revisions 
   phases: 1 draft
   remote: 1 outgoing
 
-  $ hg summary --remote --config paths.default='../clone#foo' --config paths.default-push='../clone'
+  $ hg summary --config paths.default='../clone#foo' --config paths.default-push='../clone' --remote
   parent: 4:d515801a8f3d tip
    new head to push current default head
   branch: default
@@ -297,7 +297,7 @@ Test handling common incoming revisions 
   phases: 1 draft
   remote: 2 outgoing
 
-  $ hg summary --remote --config paths.default='../clone' --config paths.default-push='../clone#foo'
+  $ hg summary --config paths.default='../clone' --config paths.default-push='../clone#foo' --remote
   parent: 4:d515801a8f3d tip
    new head to push current default head
   branch: default
@@ -311,7 +311,7 @@ Test handling common incoming revisions 
   3:4cd725637392
   4:d515801a8f3d
 
-  $ hg summary --remote --config paths.default='../another#default' --config paths.default-push='../clone#default'
+  $ hg summary --config paths.default='../another#default' --config paths.default-push='../clone#default' --remote
   parent: 4:d515801a8f3d tip
    new head to push current default head
   branch: default


More information about the Mercurial-devel mailing list