tests/test-dispatch.t
changeset 45909 ca39c45014fa
parent 45906 95c4cca641f6
child 45911 8939062597f0
equal deleted inserted replaced
45908:122f0b59f5f0 45909:ca39c45014fa
    60   [1]
    60   [1]
    61 
    61 
    62 Unparsable form of early options:
    62 Unparsable form of early options:
    63 
    63 
    64   $ hg cat --debugg
    64   $ hg cat --debugg
    65   abort: option --debugger may not be abbreviated!
    65   abort: option --debugger may not be abbreviated
    66   [255]
    66   [255]
    67 
    67 
    68 Parsing failure of early options should be detected before executing the
    68 Parsing failure of early options should be detected before executing the
    69 command:
    69 command:
    70 
    70 
    71   $ hg log -b '--config=hooks.pre-log=false' default
    71   $ hg log -b '--config=hooks.pre-log=false' default
    72   abort: option --config may not be abbreviated!
    72   abort: option --config may not be abbreviated
    73   [255]
    73   [255]
    74   $ hg log -b -R. default
    74   $ hg log -b -R. default
    75   abort: option -R has to be separated from other options (e.g. not -qR) and --repository may only be abbreviated as --repo!
    75   abort: option -R has to be separated from other options (e.g. not -qR) and --repository may only be abbreviated as --repo
    76   [255]
    76   [255]
    77   $ hg log --cwd .. -b --cwd=. default
    77   $ hg log --cwd .. -b --cwd=. default
    78   abort: option --cwd may not be abbreviated!
    78   abort: option --cwd may not be abbreviated
    79   [255]
    79   [255]
    80 
    80 
    81 However, we can't prevent it from loading extensions and configs:
    81 However, we can't prevent it from loading extensions and configs:
    82 
    82 
    83   $ cat <<EOF > bad.py
    83   $ cat <<EOF > bad.py
    84   > raise Exception('bad')
    84   > raise Exception('bad')
    85   > EOF
    85   > EOF
    86   $ hg log -b '--config=extensions.bad=bad.py' default
    86   $ hg log -b '--config=extensions.bad=bad.py' default
    87   *** failed to import extension bad from bad.py: bad
    87   *** failed to import extension bad from bad.py: bad
    88   abort: option --config may not be abbreviated!
    88   abort: option --config may not be abbreviated
    89   [255]
    89   [255]
    90 
    90 
    91   $ mkdir -p badrepo/.hg
    91   $ mkdir -p badrepo/.hg
    92   $ echo 'invalid-syntax' > badrepo/.hg/hgrc
    92   $ echo 'invalid-syntax' > badrepo/.hg/hgrc
    93   $ hg log -b -Rbadrepo default
    93   $ hg log -b -Rbadrepo default
   111   error in definition for alias 'log': --config may only be given on the command
   111   error in definition for alias 'log': --config may only be given on the command
   112   line
   112   line
   113   [255]
   113   [255]
   114 
   114 
   115   $ hg log -b '--config=defaults.log=--config=hooks.pre-log=false'
   115   $ hg log -b '--config=defaults.log=--config=hooks.pre-log=false'
   116   abort: option --config may not be abbreviated!
   116   abort: option --config may not be abbreviated
   117   [255]
   117   [255]
   118 
   118 
   119 Shell aliases bypass any command parsing rules but for the early one:
   119 Shell aliases bypass any command parsing rules but for the early one:
   120 
   120 
   121   $ hg log -b '--config=alias.log=!echo howdy'
   121   $ hg log -b '--config=alias.log=!echo howdy'
   141   $ HGPLAIN=+strictflags hg log -b --config='alias.log=!echo pwned' default
   141   $ HGPLAIN=+strictflags hg log -b --config='alias.log=!echo pwned' default
   142   abort: unknown revision '--config=alias.log=!echo pwned'
   142   abort: unknown revision '--config=alias.log=!echo pwned'
   143   [255]
   143   [255]
   144 
   144 
   145   $ HGPLAIN=+strictflags hg log --config='hooks.pre-log=false' -b default
   145   $ HGPLAIN=+strictflags hg log --config='hooks.pre-log=false' -b default
   146   abort: option --config may not be abbreviated!
   146   abort: option --config may not be abbreviated
   147   [255]
   147   [255]
   148   $ HGPLAIN=+strictflags hg log -q --cwd=.. -b default
   148   $ HGPLAIN=+strictflags hg log -q --cwd=.. -b default
   149   abort: option --cwd may not be abbreviated!
   149   abort: option --cwd may not be abbreviated
   150   [255]
   150   [255]
   151   $ HGPLAIN=+strictflags hg log -q -R . -b default
   151   $ HGPLAIN=+strictflags hg log -q -R . -b default
   152   abort: option -R has to be separated from other options (e.g. not -qR) and --repository may only be abbreviated as --repo!
   152   abort: option -R has to be separated from other options (e.g. not -qR) and --repository may only be abbreviated as --repo
   153   [255]
   153   [255]
   154 
   154 
   155   $ HGPLAIN=+strictflags hg --config='hooks.pre-log=false' log -b default
   155   $ HGPLAIN=+strictflags hg --config='hooks.pre-log=false' log -b default
   156   abort: pre-log hook exited with status 1
   156   abort: pre-log hook exited with status 1
   157   [255]
   157   [255]