author | Martin von Zweigbergk <martinvonz@google.com> |
Fri, 09 Oct 2020 09:17:47 -0700 | |
changeset 45688 | ed0ded64a8a9 |
parent 45529 | f17caf8f3fef |
child 45804 | 6991f3014311 |
permissions | -rw-r--r-- |
45050
18f8d3b31baa
rhg: add a limited `rhg root` subcommand
Antoine Cezar <antoine.cezar@octobus.net>
parents:
diff
changeset
|
1 |
#require rust |
18f8d3b31baa
rhg: add a limited `rhg root` subcommand
Antoine Cezar <antoine.cezar@octobus.net>
parents:
diff
changeset
|
2 |
|
45437
e339693addc0
rhg: add harness tests for rhg files
Antoine Cezar <antoine.cezar@octobus.net>
parents:
45050
diff
changeset
|
3 |
Define an rhg function that will only run if rhg exists |
45050
18f8d3b31baa
rhg: add a limited `rhg root` subcommand
Antoine Cezar <antoine.cezar@octobus.net>
parents:
diff
changeset
|
4 |
$ rhg() { |
18f8d3b31baa
rhg: add a limited `rhg root` subcommand
Antoine Cezar <antoine.cezar@octobus.net>
parents:
diff
changeset
|
5 |
> if [ -f "$RUNTESTDIR/../rust/target/debug/rhg" ]; then |
18f8d3b31baa
rhg: add a limited `rhg root` subcommand
Antoine Cezar <antoine.cezar@octobus.net>
parents:
diff
changeset
|
6 |
> "$RUNTESTDIR/../rust/target/debug/rhg" "$@" |
18f8d3b31baa
rhg: add a limited `rhg root` subcommand
Antoine Cezar <antoine.cezar@octobus.net>
parents:
diff
changeset
|
7 |
> else |
18f8d3b31baa
rhg: add a limited `rhg root` subcommand
Antoine Cezar <antoine.cezar@octobus.net>
parents:
diff
changeset
|
8 |
> echo "skipped: Cannot find rhg. Try to run cargo build in rust/rhg." |
18f8d3b31baa
rhg: add a limited `rhg root` subcommand
Antoine Cezar <antoine.cezar@octobus.net>
parents:
diff
changeset
|
9 |
> exit 80 |
18f8d3b31baa
rhg: add a limited `rhg root` subcommand
Antoine Cezar <antoine.cezar@octobus.net>
parents:
diff
changeset
|
10 |
> fi |
18f8d3b31baa
rhg: add a limited `rhg root` subcommand
Antoine Cezar <antoine.cezar@octobus.net>
parents:
diff
changeset
|
11 |
> } |
45437
e339693addc0
rhg: add harness tests for rhg files
Antoine Cezar <antoine.cezar@octobus.net>
parents:
45050
diff
changeset
|
12 |
|
e339693addc0
rhg: add harness tests for rhg files
Antoine Cezar <antoine.cezar@octobus.net>
parents:
45050
diff
changeset
|
13 |
Unimplemented command |
45050
18f8d3b31baa
rhg: add a limited `rhg root` subcommand
Antoine Cezar <antoine.cezar@octobus.net>
parents:
diff
changeset
|
14 |
$ rhg unimplemented-command |
45440
a6a000ab135b
rhg: print error message when argument parsing fails
Antoine Cezar <antoine.cezar@octobus.net>
parents:
45437
diff
changeset
|
15 |
error: Found argument 'unimplemented-command' which wasn't expected, or isn't valid in this context |
a6a000ab135b
rhg: print error message when argument parsing fails
Antoine Cezar <antoine.cezar@octobus.net>
parents:
45437
diff
changeset
|
16 |
|
a6a000ab135b
rhg: print error message when argument parsing fails
Antoine Cezar <antoine.cezar@octobus.net>
parents:
45437
diff
changeset
|
17 |
USAGE: |
a6a000ab135b
rhg: print error message when argument parsing fails
Antoine Cezar <antoine.cezar@octobus.net>
parents:
45437
diff
changeset
|
18 |
rhg <SUBCOMMAND> |
a6a000ab135b
rhg: print error message when argument parsing fails
Antoine Cezar <antoine.cezar@octobus.net>
parents:
45437
diff
changeset
|
19 |
|
a6a000ab135b
rhg: print error message when argument parsing fails
Antoine Cezar <antoine.cezar@octobus.net>
parents:
45437
diff
changeset
|
20 |
For more information try --help |
45050
18f8d3b31baa
rhg: add a limited `rhg root` subcommand
Antoine Cezar <antoine.cezar@octobus.net>
parents:
diff
changeset
|
21 |
[252] |
45437
e339693addc0
rhg: add harness tests for rhg files
Antoine Cezar <antoine.cezar@octobus.net>
parents:
45050
diff
changeset
|
22 |
|
e339693addc0
rhg: add harness tests for rhg files
Antoine Cezar <antoine.cezar@octobus.net>
parents:
45050
diff
changeset
|
23 |
Finding root |
45050
18f8d3b31baa
rhg: add a limited `rhg root` subcommand
Antoine Cezar <antoine.cezar@octobus.net>
parents:
diff
changeset
|
24 |
$ rhg root |
18f8d3b31baa
rhg: add a limited `rhg root` subcommand
Antoine Cezar <antoine.cezar@octobus.net>
parents:
diff
changeset
|
25 |
abort: no repository found in '$TESTTMP' (.hg not found)! |
18f8d3b31baa
rhg: add a limited `rhg root` subcommand
Antoine Cezar <antoine.cezar@octobus.net>
parents:
diff
changeset
|
26 |
[255] |
45437
e339693addc0
rhg: add harness tests for rhg files
Antoine Cezar <antoine.cezar@octobus.net>
parents:
45050
diff
changeset
|
27 |
|
45050
18f8d3b31baa
rhg: add a limited `rhg root` subcommand
Antoine Cezar <antoine.cezar@octobus.net>
parents:
diff
changeset
|
28 |
$ hg init repository |
18f8d3b31baa
rhg: add a limited `rhg root` subcommand
Antoine Cezar <antoine.cezar@octobus.net>
parents:
diff
changeset
|
29 |
$ cd repository |
18f8d3b31baa
rhg: add a limited `rhg root` subcommand
Antoine Cezar <antoine.cezar@octobus.net>
parents:
diff
changeset
|
30 |
$ rhg root |
18f8d3b31baa
rhg: add a limited `rhg root` subcommand
Antoine Cezar <antoine.cezar@octobus.net>
parents:
diff
changeset
|
31 |
$TESTTMP/repository |
45437
e339693addc0
rhg: add harness tests for rhg files
Antoine Cezar <antoine.cezar@octobus.net>
parents:
45050
diff
changeset
|
32 |
|
e339693addc0
rhg: add harness tests for rhg files
Antoine Cezar <antoine.cezar@octobus.net>
parents:
45050
diff
changeset
|
33 |
Unwritable file descriptor |
45050
18f8d3b31baa
rhg: add a limited `rhg root` subcommand
Antoine Cezar <antoine.cezar@octobus.net>
parents:
diff
changeset
|
34 |
$ rhg root > /dev/full |
18f8d3b31baa
rhg: add a limited `rhg root` subcommand
Antoine Cezar <antoine.cezar@octobus.net>
parents:
diff
changeset
|
35 |
abort: No space left on device (os error 28) |
18f8d3b31baa
rhg: add a limited `rhg root` subcommand
Antoine Cezar <antoine.cezar@octobus.net>
parents:
diff
changeset
|
36 |
[255] |
45437
e339693addc0
rhg: add harness tests for rhg files
Antoine Cezar <antoine.cezar@octobus.net>
parents:
45050
diff
changeset
|
37 |
|
e339693addc0
rhg: add harness tests for rhg files
Antoine Cezar <antoine.cezar@octobus.net>
parents:
45050
diff
changeset
|
38 |
Deleted repository |
45050
18f8d3b31baa
rhg: add a limited `rhg root` subcommand
Antoine Cezar <antoine.cezar@octobus.net>
parents:
diff
changeset
|
39 |
$ rm -rf `pwd` |
18f8d3b31baa
rhg: add a limited `rhg root` subcommand
Antoine Cezar <antoine.cezar@octobus.net>
parents:
diff
changeset
|
40 |
$ rhg root |
18f8d3b31baa
rhg: add a limited `rhg root` subcommand
Antoine Cezar <antoine.cezar@octobus.net>
parents:
diff
changeset
|
41 |
abort: error getting current working directory: $ENOENT$ |
18f8d3b31baa
rhg: add a limited `rhg root` subcommand
Antoine Cezar <antoine.cezar@octobus.net>
parents:
diff
changeset
|
42 |
[255] |
45437
e339693addc0
rhg: add harness tests for rhg files
Antoine Cezar <antoine.cezar@octobus.net>
parents:
45050
diff
changeset
|
43 |
|
e339693addc0
rhg: add harness tests for rhg files
Antoine Cezar <antoine.cezar@octobus.net>
parents:
45050
diff
changeset
|
44 |
Listing tracked files |
e339693addc0
rhg: add harness tests for rhg files
Antoine Cezar <antoine.cezar@octobus.net>
parents:
45050
diff
changeset
|
45 |
$ cd $TESTTMP |
e339693addc0
rhg: add harness tests for rhg files
Antoine Cezar <antoine.cezar@octobus.net>
parents:
45050
diff
changeset
|
46 |
$ hg init repository |
e339693addc0
rhg: add harness tests for rhg files
Antoine Cezar <antoine.cezar@octobus.net>
parents:
45050
diff
changeset
|
47 |
$ cd repository |
e339693addc0
rhg: add harness tests for rhg files
Antoine Cezar <antoine.cezar@octobus.net>
parents:
45050
diff
changeset
|
48 |
$ for i in 1 2 3; do |
e339693addc0
rhg: add harness tests for rhg files
Antoine Cezar <antoine.cezar@octobus.net>
parents:
45050
diff
changeset
|
49 |
> echo $i >> file$i |
e339693addc0
rhg: add harness tests for rhg files
Antoine Cezar <antoine.cezar@octobus.net>
parents:
45050
diff
changeset
|
50 |
> hg add file$i |
e339693addc0
rhg: add harness tests for rhg files
Antoine Cezar <antoine.cezar@octobus.net>
parents:
45050
diff
changeset
|
51 |
> done |
e339693addc0
rhg: add harness tests for rhg files
Antoine Cezar <antoine.cezar@octobus.net>
parents:
45050
diff
changeset
|
52 |
> hg commit -m "commit $i" -q |
e339693addc0
rhg: add harness tests for rhg files
Antoine Cezar <antoine.cezar@octobus.net>
parents:
45050
diff
changeset
|
53 |
|
e339693addc0
rhg: add harness tests for rhg files
Antoine Cezar <antoine.cezar@octobus.net>
parents:
45050
diff
changeset
|
54 |
Listing tracked files from root |
e339693addc0
rhg: add harness tests for rhg files
Antoine Cezar <antoine.cezar@octobus.net>
parents:
45050
diff
changeset
|
55 |
$ rhg files |
e339693addc0
rhg: add harness tests for rhg files
Antoine Cezar <antoine.cezar@octobus.net>
parents:
45050
diff
changeset
|
56 |
file1 |
e339693addc0
rhg: add harness tests for rhg files
Antoine Cezar <antoine.cezar@octobus.net>
parents:
45050
diff
changeset
|
57 |
file2 |
e339693addc0
rhg: add harness tests for rhg files
Antoine Cezar <antoine.cezar@octobus.net>
parents:
45050
diff
changeset
|
58 |
file3 |
e339693addc0
rhg: add harness tests for rhg files
Antoine Cezar <antoine.cezar@octobus.net>
parents:
45050
diff
changeset
|
59 |
|
e339693addc0
rhg: add harness tests for rhg files
Antoine Cezar <antoine.cezar@octobus.net>
parents:
45050
diff
changeset
|
60 |
Listing tracked files from subdirectory |
e339693addc0
rhg: add harness tests for rhg files
Antoine Cezar <antoine.cezar@octobus.net>
parents:
45050
diff
changeset
|
61 |
$ mkdir -p path/to/directory |
e339693addc0
rhg: add harness tests for rhg files
Antoine Cezar <antoine.cezar@octobus.net>
parents:
45050
diff
changeset
|
62 |
$ cd path/to/directory |
e339693addc0
rhg: add harness tests for rhg files
Antoine Cezar <antoine.cezar@octobus.net>
parents:
45050
diff
changeset
|
63 |
$ rhg files |
e339693addc0
rhg: add harness tests for rhg files
Antoine Cezar <antoine.cezar@octobus.net>
parents:
45050
diff
changeset
|
64 |
../../../file1 |
e339693addc0
rhg: add harness tests for rhg files
Antoine Cezar <antoine.cezar@octobus.net>
parents:
45050
diff
changeset
|
65 |
../../../file2 |
e339693addc0
rhg: add harness tests for rhg files
Antoine Cezar <antoine.cezar@octobus.net>
parents:
45050
diff
changeset
|
66 |
../../../file3 |
e339693addc0
rhg: add harness tests for rhg files
Antoine Cezar <antoine.cezar@octobus.net>
parents:
45050
diff
changeset
|
67 |
|
e339693addc0
rhg: add harness tests for rhg files
Antoine Cezar <antoine.cezar@octobus.net>
parents:
45050
diff
changeset
|
68 |
Listing tracked files through broken pipe |
e339693addc0
rhg: add harness tests for rhg files
Antoine Cezar <antoine.cezar@octobus.net>
parents:
45050
diff
changeset
|
69 |
$ rhg files | head -n 1 |
e339693addc0
rhg: add harness tests for rhg files
Antoine Cezar <antoine.cezar@octobus.net>
parents:
45050
diff
changeset
|
70 |
../../../file1 |
45529
f17caf8f3fef
rhg: add a limited `rhg debugdata` subcommand
Antoine Cezar <antoine.cezar@octobus.net>
parents:
45440
diff
changeset
|
71 |
|
f17caf8f3fef
rhg: add a limited `rhg debugdata` subcommand
Antoine Cezar <antoine.cezar@octobus.net>
parents:
45440
diff
changeset
|
72 |
Debuging data in inline index |
f17caf8f3fef
rhg: add a limited `rhg debugdata` subcommand
Antoine Cezar <antoine.cezar@octobus.net>
parents:
45440
diff
changeset
|
73 |
$ cd $TESTTMP |
f17caf8f3fef
rhg: add a limited `rhg debugdata` subcommand
Antoine Cezar <antoine.cezar@octobus.net>
parents:
45440
diff
changeset
|
74 |
$ rm -rf repository |
f17caf8f3fef
rhg: add a limited `rhg debugdata` subcommand
Antoine Cezar <antoine.cezar@octobus.net>
parents:
45440
diff
changeset
|
75 |
$ hg init repository |
f17caf8f3fef
rhg: add a limited `rhg debugdata` subcommand
Antoine Cezar <antoine.cezar@octobus.net>
parents:
45440
diff
changeset
|
76 |
$ cd repository |
f17caf8f3fef
rhg: add a limited `rhg debugdata` subcommand
Antoine Cezar <antoine.cezar@octobus.net>
parents:
45440
diff
changeset
|
77 |
$ for i in 1 2 3; do |
f17caf8f3fef
rhg: add a limited `rhg debugdata` subcommand
Antoine Cezar <antoine.cezar@octobus.net>
parents:
45440
diff
changeset
|
78 |
> echo $i >> file$i |
f17caf8f3fef
rhg: add a limited `rhg debugdata` subcommand
Antoine Cezar <antoine.cezar@octobus.net>
parents:
45440
diff
changeset
|
79 |
> hg add file$i |
f17caf8f3fef
rhg: add a limited `rhg debugdata` subcommand
Antoine Cezar <antoine.cezar@octobus.net>
parents:
45440
diff
changeset
|
80 |
> hg commit -m "commit $i" -q |
f17caf8f3fef
rhg: add a limited `rhg debugdata` subcommand
Antoine Cezar <antoine.cezar@octobus.net>
parents:
45440
diff
changeset
|
81 |
> done |
f17caf8f3fef
rhg: add a limited `rhg debugdata` subcommand
Antoine Cezar <antoine.cezar@octobus.net>
parents:
45440
diff
changeset
|
82 |
$ rhg debugdata -c 2 |
f17caf8f3fef
rhg: add a limited `rhg debugdata` subcommand
Antoine Cezar <antoine.cezar@octobus.net>
parents:
45440
diff
changeset
|
83 |
e36fa63d37a576b27a69057598351db6ee5746bd |
f17caf8f3fef
rhg: add a limited `rhg debugdata` subcommand
Antoine Cezar <antoine.cezar@octobus.net>
parents:
45440
diff
changeset
|
84 |
test |
f17caf8f3fef
rhg: add a limited `rhg debugdata` subcommand
Antoine Cezar <antoine.cezar@octobus.net>
parents:
45440
diff
changeset
|
85 |
0 0 |
f17caf8f3fef
rhg: add a limited `rhg debugdata` subcommand
Antoine Cezar <antoine.cezar@octobus.net>
parents:
45440
diff
changeset
|
86 |
file3 |
f17caf8f3fef
rhg: add a limited `rhg debugdata` subcommand
Antoine Cezar <antoine.cezar@octobus.net>
parents:
45440
diff
changeset
|
87 |
|
f17caf8f3fef
rhg: add a limited `rhg debugdata` subcommand
Antoine Cezar <antoine.cezar@octobus.net>
parents:
45440
diff
changeset
|
88 |
commit 3 (no-eol) |
f17caf8f3fef
rhg: add a limited `rhg debugdata` subcommand
Antoine Cezar <antoine.cezar@octobus.net>
parents:
45440
diff
changeset
|
89 |
$ rhg debugdata -m 2 |
f17caf8f3fef
rhg: add a limited `rhg debugdata` subcommand
Antoine Cezar <antoine.cezar@octobus.net>
parents:
45440
diff
changeset
|
90 |
file1\x00b8e02f6433738021a065f94175c7cd23db5f05be (esc) |
f17caf8f3fef
rhg: add a limited `rhg debugdata` subcommand
Antoine Cezar <antoine.cezar@octobus.net>
parents:
45440
diff
changeset
|
91 |
file2\x005d9299349fc01ddd25d0070d149b124d8f10411e (esc) |
f17caf8f3fef
rhg: add a limited `rhg debugdata` subcommand
Antoine Cezar <antoine.cezar@octobus.net>
parents:
45440
diff
changeset
|
92 |
file3\x002661d26c649684b482d10f91960cc3db683c38b4 (esc) |