Show More
@@ -1,69 +1,105 b'' | |||
|
1 | #!/bin/sh | |
|
2 | ||
|
3 | commit() | |
|
4 | { | |
|
5 | msg=$1 | |
|
6 | p1=$2 | |
|
7 | p2=$3 | |
|
8 | ||
|
9 | if [ "$p1" ]; then | |
|
10 | hg up -qC $p1 | |
|
11 | fi | |
|
12 | ||
|
13 | if [ "$p2" ]; then | |
|
14 | HGMERGE=true hg merge -q $p2 | |
|
15 | fi | |
|
16 | 1 | |
|
17 | echo >> foo | |
|
18 | ||
|
19 | hg commit -qAm "$msg" | |
|
20 | } | |
|
21 | ||
|
22 | hg init repo | |
|
23 | cd repo | |
|
2 | $ commit() | |
|
3 | > { | |
|
4 | > msg=$1 | |
|
5 | > p1=$2 | |
|
6 | > p2=$3 | |
|
7 | > | |
|
8 | > if [ "$p1" ]; then | |
|
9 | > hg up -qC $p1 | |
|
10 | > fi | |
|
11 | > | |
|
12 | > if [ "$p2" ]; then | |
|
13 | > HGMERGE=true hg merge -q $p2 | |
|
14 | > fi | |
|
15 | > | |
|
16 | > echo >> foo | |
|
17 | > | |
|
18 | > hg commit -qAm "$msg" | |
|
19 | > } | |
|
20 | $ hg init repo | |
|
21 | $ cd repo | |
|
22 | $ echo '[extensions]' > .hg/hgrc | |
|
23 | $ echo 'parentrevspec =' >> .hg/hgrc | |
|
24 | $ commit '0: add foo' | |
|
25 | $ commit '1: change foo 1' | |
|
26 | $ commit '2: change foo 2a' | |
|
27 | $ commit '3: change foo 3a' | |
|
28 | $ commit '4: change foo 2b' 1 | |
|
29 | $ commit '5: merge' 3 4 | |
|
30 | $ commit '6: change foo again' | |
|
31 | $ hg log --template '{rev}:{node|short} {parents}\n' | |
|
32 | 6:755d1e0d79e9 | |
|
33 | 5:9ce2ce29723a 3:a3e00c7dbf11 4:bb4475edb621 | |
|
34 | 4:bb4475edb621 1:5d953a1917d1 | |
|
35 | 3:a3e00c7dbf11 | |
|
36 | 2:befc7d89d081 | |
|
37 | 1:5d953a1917d1 | |
|
38 | 0:837088b6e1d9 | |
|
39 | $ echo | |
|
40 | ||
|
41 | $ lookup() | |
|
42 | > { | |
|
43 | > for rev in "$@"; do | |
|
44 | > printf "$rev: " | |
|
45 | > hg id -nr $rev | |
|
46 | > done | |
|
47 | > true | |
|
48 | > } | |
|
49 | $ tipnode=`hg id -ir tip` | |
|
24 | 50 | |
|
25 | echo '[extensions]' > .hg/hgrc | |
|
26 | echo 'parentrevspec =' >> .hg/hgrc | |
|
27 | ||
|
28 | commit '0: add foo' | |
|
29 | commit '1: change foo 1' | |
|
30 | commit '2: change foo 2a' | |
|
31 | commit '3: change foo 3a' | |
|
32 | commit '4: change foo 2b' 1 | |
|
33 | commit '5: merge' 3 4 | |
|
34 | commit '6: change foo again' | |
|
51 | should work with tag/branch/node/rev | |
|
35 | 52 | |
|
36 | hg log --template '{rev}:{node|short} {parents}\n' | |
|
37 | echo | |
|
53 | $ for r in tip default $tipnode 6; do | |
|
54 | > lookup "$r^" | |
|
55 | > done | |
|
56 | tip^: 5 | |
|
57 | default^: 5 | |
|
58 | 755d1e0d79e9^: 5 | |
|
59 | 6^: 5 | |
|
60 | $ echo | |
|
61 | ||
|
38 | 62 | |
|
39 | lookup() | |
|
40 | { | |
|
41 | for rev in "$@"; do | |
|
42 | printf "$rev: " | |
|
43 | hg id -nr $rev | |
|
44 | done | |
|
45 | true | |
|
46 | } | |
|
47 | ||
|
48 | tipnode=`hg id -ir tip` | |
|
63 | some random lookups | |
|
49 | 64 | |
|
50 | echo 'should work with tag/branch/node/rev' | |
|
51 | for r in tip default $tipnode 6; do | |
|
52 | lookup "$r^" | |
|
53 | done | |
|
54 | echo | |
|
65 | $ lookup "6^^" "6^^^" "6^^^^" "6^^^^^" "6^^^^^^" "6^1" "6^2" "6^^2" "6^1^2" "6^^3" | |
|
66 | 6^^: 3 | |
|
67 | 6^^^: 2 | |
|
68 | 6^^^^: 1 | |
|
69 | 6^^^^^: 0 | |
|
70 | 6^^^^^^: -1 | |
|
71 | 6^1: 5 | |
|
72 | 6^2: abort: unknown revision '6^2'! | |
|
73 | 6^^2: 4 | |
|
74 | 6^1^2: 4 | |
|
75 | 6^^3: abort: unknown revision '6^^3'! | |
|
76 | $ lookup "6~" "6~1" "6~2" "6~3" "6~4" "6~5" "6~42" "6~1^2" "6~1^2~2" | |
|
77 | 6~: abort: unknown revision '6~'! | |
|
78 | 6~1: 5 | |
|
79 | 6~2: 3 | |
|
80 | 6~3: 2 | |
|
81 | 6~4: 1 | |
|
82 | 6~5: 0 | |
|
83 | 6~42: -1 | |
|
84 | 6~1^2: 4 | |
|
85 | 6~1^2~2: 0 | |
|
86 | $ echo | |
|
87 | ||
|
55 | 88 | |
|
56 | echo 'some random lookups' | |
|
57 | lookup "6^^" "6^^^" "6^^^^" "6^^^^^" "6^^^^^^" "6^1" "6^2" "6^^2" "6^1^2" "6^^3" | |
|
58 | lookup "6~" "6~1" "6~2" "6~3" "6~4" "6~5" "6~42" "6~1^2" "6~1^2~2" | |
|
59 | echo | |
|
89 | with a tag "6^" pointing to rev 1 | |
|
60 | 90 | |
|
61 | echo 'with a tag "6^" pointing to rev 1' | |
|
62 | hg tag -l -r 1 "6^" | |
|
63 | lookup "6^" "6^1" "6~1" "6^^" | |
|
64 | echo | |
|
91 | $ hg tag -l -r 1 "6^" | |
|
92 | $ lookup "6^" "6^1" "6~1" "6^^" | |
|
93 | 6^: 1 | |
|
94 | 6^1: 5 | |
|
95 | 6~1: 5 | |
|
96 | 6^^: 3 | |
|
97 | $ echo | |
|
98 | ||
|
65 | 99 | |
|
66 |
|
|
|
67 | hg tag -l -r 2 "foo^bar" | |
|
68 | lookup "foo^bar" "foo^bar^" | |
|
100 | with a tag "foo^bar" pointing to rev 2 | |
|
69 | 101 | |
|
102 | $ hg tag -l -r 2 "foo^bar" | |
|
103 | $ lookup "foo^bar" "foo^bar^" | |
|
104 | foo^bar: 2 | |
|
105 | foo^bar^: abort: unknown revision 'foo^bar^'! |
|
1 | NO CONTENT: file was removed |
General Comments 0
You need to be logged in to leave comments.
Login now