Mercurial > hg
annotate tests/test-dispatch.t @ 12269:877236cdd437
add: move main part to cmdutil to make it easier to reuse
author | Martin Geisler <mg@lazybytes.net> |
---|---|
date | Mon, 13 Sep 2010 13:09:11 +0200 |
parents | 88250a460bf8 |
children | 4134686b83e1 |
rev | line source |
---|---|
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 Print the specified files as they were at the given revision. If no |
88250a460bf8
tests: unify test-dispatch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12028
diff
changeset
|
22 revision is given, the parent of the working directory is used, or tip if |
88250a460bf8
tests: unify test-dispatch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12028
diff
changeset
|
23 no revision is checked out. |
88250a460bf8
tests: unify test-dispatch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12028
diff
changeset
|
24 |
88250a460bf8
tests: unify test-dispatch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12028
diff
changeset
|
25 Output may be to a file, in which case the name of the file is given using |
88250a460bf8
tests: unify test-dispatch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12028
diff
changeset
|
26 a format string. The formatting rules are the same as for the export |
88250a460bf8
tests: unify test-dispatch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12028
diff
changeset
|
27 command, with the following additions: |
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 "%s" basename of file being printed |
88250a460bf8
tests: unify test-dispatch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12028
diff
changeset
|
30 "%d" dirname of file being printed, or '.' if in repository root |
88250a460bf8
tests: unify test-dispatch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12028
diff
changeset
|
31 "%p" root-relative path name of file being printed |
88250a460bf8
tests: unify test-dispatch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12028
diff
changeset
|
32 |
88250a460bf8
tests: unify test-dispatch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12028
diff
changeset
|
33 Returns 0 on success. |
88250a460bf8
tests: unify test-dispatch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12028
diff
changeset
|
34 |
88250a460bf8
tests: unify test-dispatch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12028
diff
changeset
|
35 options: |
88250a460bf8
tests: unify test-dispatch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12028
diff
changeset
|
36 |
88250a460bf8
tests: unify test-dispatch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12028
diff
changeset
|
37 -o --output FORMAT print output to file with formatted name |
88250a460bf8
tests: unify test-dispatch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12028
diff
changeset
|
38 -r --rev REV print the given revision |
88250a460bf8
tests: unify test-dispatch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12028
diff
changeset
|
39 --decode apply any matching decode filter |
88250a460bf8
tests: unify test-dispatch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12028
diff
changeset
|
40 -I --include PATTERN [+] include names matching the given patterns |
88250a460bf8
tests: unify test-dispatch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12028
diff
changeset
|
41 -X --exclude PATTERN [+] exclude names matching the given patterns |
88250a460bf8
tests: unify test-dispatch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12028
diff
changeset
|
42 |
88250a460bf8
tests: unify test-dispatch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12028
diff
changeset
|
43 [+] marked option can be specified multiple times |
88250a460bf8
tests: unify test-dispatch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12028
diff
changeset
|
44 |
88250a460bf8
tests: unify test-dispatch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12028
diff
changeset
|
45 use "hg -v help cat" to show global options |
88250a460bf8
tests: unify test-dispatch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12028
diff
changeset
|
46 |
4563
8044be585b91
dispatch: restore a dropped shlex import
Brendan Cully <brendan@kublai.com>
parents:
diff
changeset
|
47 [defaults] |
4621
6fc26982f203
dispatch: fix handling of incorrect number of arguments
Matt Mackall <mpm@selenic.com>
parents:
4563
diff
changeset
|
48 |
12157
88250a460bf8
tests: unify test-dispatch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12028
diff
changeset
|
49 $ hg cat a |
88250a460bf8
tests: unify test-dispatch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12028
diff
changeset
|
50 a |
88250a460bf8
tests: unify test-dispatch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12028
diff
changeset
|
51 $ cat >> $HGRCPATH <<EOF |
88250a460bf8
tests: unify test-dispatch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12028
diff
changeset
|
52 > [defaults] |
88250a460bf8
tests: unify test-dispatch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12028
diff
changeset
|
53 > cat = -r null |
88250a460bf8
tests: unify test-dispatch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12028
diff
changeset
|
54 > EOF |
88250a460bf8
tests: unify test-dispatch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12028
diff
changeset
|
55 $ hg cat a |
88250a460bf8
tests: unify test-dispatch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12028
diff
changeset
|
56 a: no such file in rev 000000000000 |
4654
e0e73ba37983
Fix dispatch error message when not in a repo
Brendan Cully <brendan@kublai.com>
parents:
4621
diff
changeset
|
57 |
12157
88250a460bf8
tests: unify test-dispatch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12028
diff
changeset
|
58 No repo: |
4659
7a7d4937272b
Kill trailing spaces
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4654
diff
changeset
|
59 |
12157
88250a460bf8
tests: unify test-dispatch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12028
diff
changeset
|
60 $ cd $dir |
88250a460bf8
tests: unify test-dispatch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12028
diff
changeset
|
61 $ hg cat |
88250a460bf8
tests: unify test-dispatch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12028
diff
changeset
|
62 abort: There is no Mercurial repository here (.hg not found)! |
88250a460bf8
tests: unify test-dispatch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12028
diff
changeset
|
63 |
88250a460bf8
tests: unify test-dispatch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12028
diff
changeset
|
64 $ exit 0 |
88250a460bf8
tests: unify test-dispatch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12028
diff
changeset
|
65 |