tests/test-dispatch.t
author Adrian Buehlmann <adrian@cadifra.com>
Sun, 17 Apr 2011 11:37:11 +0200
changeset 13950 14d0553bd48b
parent 12327 92e30e135581
child 13967 f85c9b0fdb32
permissions -rw-r--r--
help: do not show full help text for command on option errors Example $ hg clone --jump foo bar hg clone: option --jump not recognized hg clone [OPTION]... SOURCE [DEST] make a copy of an existing repository options: -U --noupdate the clone will include an empty working copy (only a repository) -u --updaterev REV revision, tag or branch to check out -r --rev REV [+] include the specified changeset -b --branch BRANCH [+] clone only the specified branch --pull use pull protocol to copy metadata --uncompressed use uncompressed transfer (fast over LAN) -e --ssh CMD specify ssh command to use --remotecmd CMD specify hg command to run on the remote side --insecure do not verify server certificate (ignoring web.cacerts config) [+] marked option can be specified multiple times use "hg help clone" to show the full help text Motivation for this change If the user already has specified the command, he probably already knows the command to some extent. Apparently, he has a problem with the options, so we show him just the synopsis with the short help and the details about the options, with a hint on the last line how to get the full help text. Why is Mercurial better with this change? Experts who just forgot about the details of an option don't get that much text thrown at them, while the newbies still get a hint on the last line how to get the full help text.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
12157
88250a460bf8 tests: unify test-dispatch
Adrian Buehlmann <adrian@cadifra.com>
parents: 12028
diff changeset
     1
test command parsing and dispatch
4563
8044be585b91 dispatch: restore a dropped shlex import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
     2
12157
88250a460bf8 tests: unify test-dispatch
Adrian Buehlmann <adrian@cadifra.com>
parents: 12028
diff changeset
     3
  $ "$TESTDIR/hghave" no-outer-repo || exit 80
7429
dbc40381620e tests: Skip tests if they will fail because of outer repo
Mads Kiilerich <mads@kiilerich.com>
parents: 5523
diff changeset
     4
12157
88250a460bf8 tests: unify test-dispatch
Adrian Buehlmann <adrian@cadifra.com>
parents: 12028
diff changeset
     5
  $ dir=`pwd`
11675
f92f8921a5cc dispatch: give better error message when cwd doesn't exist (issue2293)
Mads Kiilerich <mads@kiilerich.com>
parents: 8637
diff changeset
     6
12157
88250a460bf8 tests: unify test-dispatch
Adrian Buehlmann <adrian@cadifra.com>
parents: 12028
diff changeset
     7
  $ hg init a
88250a460bf8 tests: unify test-dispatch
Adrian Buehlmann <adrian@cadifra.com>
parents: 12028
diff changeset
     8
  $ cd a
88250a460bf8 tests: unify test-dispatch
Adrian Buehlmann <adrian@cadifra.com>
parents: 12028
diff changeset
     9
  $ echo a > a
88250a460bf8 tests: unify test-dispatch
Adrian Buehlmann <adrian@cadifra.com>
parents: 12028
diff changeset
    10
  $ hg ci -Ama
88250a460bf8 tests: unify test-dispatch
Adrian Buehlmann <adrian@cadifra.com>
parents: 12028
diff changeset
    11
  adding a
4563
8044be585b91 dispatch: restore a dropped shlex import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    12
12157
88250a460bf8 tests: unify test-dispatch
Adrian Buehlmann <adrian@cadifra.com>
parents: 12028
diff changeset
    13
Missing arg:
4621
6fc26982f203 dispatch: fix handling of incorrect number of arguments
Matt Mackall <mpm@selenic.com>
parents: 4563
diff changeset
    14
12157
88250a460bf8 tests: unify test-dispatch
Adrian Buehlmann <adrian@cadifra.com>
parents: 12028
diff changeset
    15
  $ hg cat
88250a460bf8 tests: unify test-dispatch
Adrian Buehlmann <adrian@cadifra.com>
parents: 12028
diff changeset
    16
  hg cat: invalid arguments
88250a460bf8 tests: unify test-dispatch
Adrian Buehlmann <adrian@cadifra.com>
parents: 12028
diff changeset
    17
  hg cat [OPTION]... FILE...
88250a460bf8 tests: unify test-dispatch
Adrian Buehlmann <adrian@cadifra.com>
parents: 12028
diff changeset
    18
  
88250a460bf8 tests: unify test-dispatch
Adrian Buehlmann <adrian@cadifra.com>
parents: 12028
diff changeset
    19
  output the current or given revision of files
88250a460bf8 tests: unify test-dispatch
Adrian Buehlmann <adrian@cadifra.com>
parents: 12028
diff changeset
    20
  
88250a460bf8 tests: unify test-dispatch
Adrian Buehlmann <adrian@cadifra.com>
parents: 12028
diff changeset
    21
  options:
88250a460bf8 tests: unify test-dispatch
Adrian Buehlmann <adrian@cadifra.com>
parents: 12028
diff changeset
    22
  
88250a460bf8 tests: unify test-dispatch
Adrian Buehlmann <adrian@cadifra.com>
parents: 12028
diff changeset
    23
   -o --output FORMAT        print output to file with formatted name
88250a460bf8 tests: unify test-dispatch
Adrian Buehlmann <adrian@cadifra.com>
parents: 12028
diff changeset
    24
   -r --rev REV              print the given revision
88250a460bf8 tests: unify test-dispatch
Adrian Buehlmann <adrian@cadifra.com>
parents: 12028
diff changeset
    25
      --decode               apply any matching decode filter
88250a460bf8 tests: unify test-dispatch
Adrian Buehlmann <adrian@cadifra.com>
parents: 12028
diff changeset
    26
   -I --include PATTERN [+]  include names matching the given patterns
88250a460bf8 tests: unify test-dispatch
Adrian Buehlmann <adrian@cadifra.com>
parents: 12028
diff changeset
    27
   -X --exclude PATTERN [+]  exclude names matching the given patterns
88250a460bf8 tests: unify test-dispatch
Adrian Buehlmann <adrian@cadifra.com>
parents: 12028
diff changeset
    28
  
88250a460bf8 tests: unify test-dispatch
Adrian Buehlmann <adrian@cadifra.com>
parents: 12028
diff changeset
    29
  [+] marked option can be specified multiple times
88250a460bf8 tests: unify test-dispatch
Adrian Buehlmann <adrian@cadifra.com>
parents: 12028
diff changeset
    30
  
13950
14d0553bd48b help: do not show full help text for command on option errors
Adrian Buehlmann <adrian@cadifra.com>
parents: 12327
diff changeset
    31
  use "hg help cat" to show the full help text
12316
4134686b83e1 tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents: 12157
diff changeset
    32
  [255]
12157
88250a460bf8 tests: unify test-dispatch
Adrian Buehlmann <adrian@cadifra.com>
parents: 12028
diff changeset
    33
4563
8044be585b91 dispatch: restore a dropped shlex import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    34
[defaults]
4621
6fc26982f203 dispatch: fix handling of incorrect number of arguments
Matt Mackall <mpm@selenic.com>
parents: 4563
diff changeset
    35
12157
88250a460bf8 tests: unify test-dispatch
Adrian Buehlmann <adrian@cadifra.com>
parents: 12028
diff changeset
    36
  $ hg cat a
88250a460bf8 tests: unify test-dispatch
Adrian Buehlmann <adrian@cadifra.com>
parents: 12028
diff changeset
    37
  a
88250a460bf8 tests: unify test-dispatch
Adrian Buehlmann <adrian@cadifra.com>
parents: 12028
diff changeset
    38
  $ cat >> $HGRCPATH <<EOF
88250a460bf8 tests: unify test-dispatch
Adrian Buehlmann <adrian@cadifra.com>
parents: 12028
diff changeset
    39
  > [defaults]
88250a460bf8 tests: unify test-dispatch
Adrian Buehlmann <adrian@cadifra.com>
parents: 12028
diff changeset
    40
  > cat = -r null
88250a460bf8 tests: unify test-dispatch
Adrian Buehlmann <adrian@cadifra.com>
parents: 12028
diff changeset
    41
  > EOF
88250a460bf8 tests: unify test-dispatch
Adrian Buehlmann <adrian@cadifra.com>
parents: 12028
diff changeset
    42
  $ hg cat a
88250a460bf8 tests: unify test-dispatch
Adrian Buehlmann <adrian@cadifra.com>
parents: 12028
diff changeset
    43
  a: no such file in rev 000000000000
12316
4134686b83e1 tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents: 12157
diff changeset
    44
  [1]
4654
e0e73ba37983 Fix dispatch error message when not in a repo
Brendan Cully <brendan@kublai.com>
parents: 4621
diff changeset
    45
12157
88250a460bf8 tests: unify test-dispatch
Adrian Buehlmann <adrian@cadifra.com>
parents: 12028
diff changeset
    46
No repo:
4659
7a7d4937272b Kill trailing spaces
Thomas Arendsen Hein <thomas@intevation.de>
parents: 4654
diff changeset
    47
12157
88250a460bf8 tests: unify test-dispatch
Adrian Buehlmann <adrian@cadifra.com>
parents: 12028
diff changeset
    48
  $ cd $dir
88250a460bf8 tests: unify test-dispatch
Adrian Buehlmann <adrian@cadifra.com>
parents: 12028
diff changeset
    49
  $ hg cat
88250a460bf8 tests: unify test-dispatch
Adrian Buehlmann <adrian@cadifra.com>
parents: 12028
diff changeset
    50
  abort: There is no Mercurial repository here (.hg not found)!
12316
4134686b83e1 tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents: 12157
diff changeset
    51
  [255]
12157
88250a460bf8 tests: unify test-dispatch
Adrian Buehlmann <adrian@cadifra.com>
parents: 12028
diff changeset
    52