Show More
@@ -1,126 +1,159 b'' | |||||
1 | #!/bin/sh |
|
1 | #!/bin/sh | |
2 |
|
2 | |||
3 | HGMERGE=true; export HGMERGE |
|
3 | HGMERGE=true; export HGMERGE | |
4 |
|
4 | |||
5 | hg init basic |
|
5 | hg init basic | |
6 | cd basic |
|
6 | cd basic | |
7 |
|
7 | |||
8 | echo '# should complain' |
|
8 | echo '# should complain' | |
9 | hg backout |
|
9 | hg backout | |
10 | hg backout -r 0 0 |
|
10 | hg backout -r 0 0 | |
11 |
|
11 | |||
12 | echo '# basic operation' |
|
12 | echo '# basic operation' | |
13 | echo a > a |
|
13 | echo a > a | |
14 | hg commit -d '0 0' -A -m a |
|
14 | hg commit -d '0 0' -A -m a | |
15 | echo b >> a |
|
15 | echo b >> a | |
16 | hg commit -d '1 0' -m b |
|
16 | hg commit -d '1 0' -m b | |
17 |
|
17 | |||
18 | hg backout -d '2 0' tip |
|
18 | hg backout -d '2 0' tip | |
19 | cat a |
|
19 | cat a | |
20 |
|
20 | |||
21 | echo '# file that was removed is recreated' |
|
21 | echo '# file that was removed is recreated' | |
22 | cd .. |
|
22 | cd .. | |
23 | hg init remove |
|
23 | hg init remove | |
24 | cd remove |
|
24 | cd remove | |
25 |
|
25 | |||
26 | echo content > a |
|
26 | echo content > a | |
27 | hg commit -d '0 0' -A -m a |
|
27 | hg commit -d '0 0' -A -m a | |
28 |
|
28 | |||
29 | hg rm a |
|
29 | hg rm a | |
30 | hg commit -d '1 0' -m b |
|
30 | hg commit -d '1 0' -m b | |
31 |
|
31 | |||
32 | hg backout -d '2 0' --merge tip |
|
32 | hg backout -d '2 0' --merge tip | |
33 | cat a |
|
33 | cat a | |
34 |
|
34 | |||
35 | echo '# backout of backout is as if nothing happened' |
|
35 | echo '# backout of backout is as if nothing happened' | |
36 |
|
36 | |||
37 | hg backout -d '3 0' --merge tip |
|
37 | hg backout -d '3 0' --merge tip | |
38 | cat a 2>/dev/null || echo cat: a: No such file or directory |
|
38 | cat a 2>/dev/null || echo cat: a: No such file or directory | |
39 |
|
39 | |||
40 | echo '# across branch' |
|
40 | echo '# across branch' | |
41 | cd .. |
|
41 | cd .. | |
42 | hg init branch |
|
42 | hg init branch | |
43 | cd branch |
|
43 | cd branch | |
44 | echo a > a |
|
44 | echo a > a | |
45 | hg ci -Am0 -d '0 0' |
|
45 | hg ci -Am0 -d '0 0' | |
46 | echo b > b |
|
46 | echo b > b | |
47 | hg ci -Am1 -d '0 0' |
|
47 | hg ci -Am1 -d '0 0' | |
48 | hg co -C 0 |
|
48 | hg co -C 0 | |
49 | # should fail |
|
49 | # should fail | |
50 | hg backout -d '0 0' 1 |
|
50 | hg backout -d '0 0' 1 | |
51 | echo c > c |
|
51 | echo c > c | |
52 | hg ci -Am2 -d '0 0' |
|
52 | hg ci -Am2 -d '0 0' | |
53 | # should fail |
|
53 | # should fail | |
54 | hg backout -d '0 0' 1 |
|
54 | hg backout -d '0 0' 1 | |
55 |
|
55 | |||
56 | echo '# backout with merge' |
|
56 | echo '# backout with merge' | |
57 | cd .. |
|
57 | cd .. | |
58 | hg init merge |
|
58 | hg init merge | |
59 | cd merge |
|
59 | cd merge | |
60 |
|
60 | |||
61 | echo line 1 > a |
|
61 | echo line 1 > a | |
62 | echo line 2 >> a |
|
62 | echo line 2 >> a | |
63 | hg commit -d '0 0' -A -m a |
|
63 | hg commit -d '0 0' -A -m a | |
64 | # remove line 1 |
|
64 | # remove line 1 | |
65 | echo line 2 > a |
|
65 | echo line 2 > a | |
66 | hg commit -d '1 0' -m b |
|
66 | hg commit -d '1 0' -m b | |
67 |
|
67 | |||
68 | echo line 3 >> a |
|
68 | echo line 3 >> a | |
69 | hg commit -d '2 0' -m c |
|
69 | hg commit -d '2 0' -m c | |
70 |
|
70 | |||
71 | hg backout --merge -d '3 0' 1 |
|
71 | hg backout --merge -d '3 0' 1 | |
72 | hg commit -d '4 0' -m d |
|
72 | hg commit -d '4 0' -m d | |
73 | # check line 1 is back |
|
73 | # check line 1 is back | |
74 | cat a |
|
74 | cat a | |
75 |
|
75 | |||
76 | echo '# backout should not back out subsequent changesets' |
|
76 | echo '# backout should not back out subsequent changesets' | |
77 | hg init onecs |
|
77 | hg init onecs | |
78 | cd onecs |
|
78 | cd onecs | |
79 | echo 1 > a |
|
79 | echo 1 > a | |
80 | hg commit -d '0 0' -A -m a |
|
80 | hg commit -d '0 0' -A -m a | |
81 | echo 2 >> a |
|
81 | echo 2 >> a | |
82 | hg commit -d '1 0' -m b |
|
82 | hg commit -d '1 0' -m b | |
83 | echo 1 > b |
|
83 | echo 1 > b | |
84 | hg commit -d '2 0' -A -m c |
|
84 | hg commit -d '2 0' -A -m c | |
85 | hg backout -d '3 0' 1 |
|
85 | hg backout -d '3 0' 1 | |
86 | hg locate b |
|
86 | hg locate b | |
87 | hg update -C tip |
|
87 | hg update -C tip | |
88 | hg locate b |
|
88 | hg locate b | |
89 |
|
89 | |||
90 | cd .. |
|
90 | cd .. | |
91 | hg init m |
|
91 | hg init m | |
92 | cd m |
|
92 | cd m | |
93 | echo a > a |
|
93 | echo a > a | |
94 | hg commit -d '0 0' -A -m a |
|
94 | hg commit -d '0 0' -A -m a | |
95 | echo b > b |
|
95 | echo b > b | |
96 | hg commit -d '1 0' -A -m b |
|
96 | hg commit -d '1 0' -A -m b | |
97 | echo c > c |
|
97 | echo c > c | |
98 | hg commit -d '2 0' -A -m b |
|
98 | hg commit -d '2 0' -A -m b | |
99 | hg update 1 |
|
99 | hg update 1 | |
100 | echo d > d |
|
100 | echo d > d | |
101 | hg commit -d '3 0' -A -m c |
|
101 | hg commit -d '3 0' -A -m c | |
102 | hg merge 2 |
|
102 | hg merge 2 | |
103 | hg commit -d '4 0' -A -m d |
|
103 | hg commit -d '4 0' -A -m d | |
104 |
|
104 | |||
105 | echo '# backout of merge should fail' |
|
105 | echo '# backout of merge should fail' | |
106 |
|
106 | |||
107 | hg backout 4 |
|
107 | hg backout 4 | |
108 |
|
108 | |||
109 | echo '# backout of merge with bad parent should fail' |
|
109 | echo '# backout of merge with bad parent should fail' | |
110 |
|
110 | |||
111 | hg backout --parent 0 4 |
|
111 | hg backout --parent 0 4 | |
112 |
|
112 | |||
113 | echo '# backout of non-merge with parent should fail' |
|
113 | echo '# backout of non-merge with parent should fail' | |
114 |
|
114 | |||
115 | hg backout --parent 0 3 |
|
115 | hg backout --parent 0 3 | |
116 |
|
116 | |||
117 | echo '# backout with valid parent should be ok' |
|
117 | echo '# backout with valid parent should be ok' | |
118 |
|
118 | |||
119 | hg backout -d '5 0' --parent 2 4 |
|
119 | hg backout -d '5 0' --parent 2 4 | |
120 |
|
120 | |||
121 | hg rollback |
|
121 | hg rollback | |
122 | hg update -C |
|
122 | hg update -C | |
123 |
|
123 | |||
124 | hg backout -d '6 0' --parent 3 4 |
|
124 | hg backout -d '6 0' --parent 3 4 | |
125 |
|
125 | |||
|
126 | cd .. | |||
|
127 | ||||
|
128 | echo '# named branches' | |||
|
129 | ||||
|
130 | hg init named_branches | |||
|
131 | cd named_branches | |||
|
132 | ||||
|
133 | echo default > default | |||
|
134 | hg ci -d '0 0' -Am default | |||
|
135 | hg branch branch1 | |||
|
136 | echo branch1 > file1 | |||
|
137 | hg ci -d '1 0' -Am file1 | |||
|
138 | hg branch branch2 | |||
|
139 | echo branch2 > file2 | |||
|
140 | hg ci -d '2 0' -Am file2 | |||
|
141 | hg backout -d '3 0' -r 1 -m 'backout on branch1' | |||
|
142 | # XXX maybe backout shouldn't suggest a merge here as it is a different branch? | |||
|
143 | ||||
|
144 | echo '% on branch2 with branch1 not merged, so file1 should still exist:' | |||
|
145 | hg id | |||
|
146 | hg st -A | |||
|
147 | ||||
|
148 | echo '% on branch2 with branch1 merged, so file1 should be gone:' | |||
|
149 | hg merge | |||
|
150 | hg ci -d '4 0' -m 'merge backout of branch1' | |||
|
151 | hg id | |||
|
152 | hg st -A | |||
|
153 | ||||
|
154 | echo '% on branch1, so no file1 and file2:' | |||
|
155 | hg co -C branch1 | |||
|
156 | hg id | |||
|
157 | hg st -A | |||
|
158 | ||||
126 | exit 0 |
|
159 | exit 0 |
@@ -1,64 +1,89 b'' | |||||
1 | # should complain |
|
1 | # should complain | |
2 | abort: please specify a revision to backout |
|
2 | abort: please specify a revision to backout | |
3 | abort: please specify just one revision |
|
3 | abort: please specify just one revision | |
4 | # basic operation |
|
4 | # basic operation | |
5 | adding a |
|
5 | adding a | |
6 | reverting a |
|
6 | reverting a | |
7 | changeset 2:2929462c3dff backs out changeset 1:a820f4f40a57 |
|
7 | changeset 2:2929462c3dff backs out changeset 1:a820f4f40a57 | |
8 | a |
|
8 | a | |
9 | # file that was removed is recreated |
|
9 | # file that was removed is recreated | |
10 | adding a |
|
10 | adding a | |
11 | adding a |
|
11 | adding a | |
12 | changeset 2:de31bdc76c0d backs out changeset 1:76862dcce372 |
|
12 | changeset 2:de31bdc76c0d backs out changeset 1:76862dcce372 | |
13 | content |
|
13 | content | |
14 | # backout of backout is as if nothing happened |
|
14 | # backout of backout is as if nothing happened | |
15 | removing a |
|
15 | removing a | |
16 | changeset 3:7f6d0f120113 backs out changeset 2:de31bdc76c0d |
|
16 | changeset 3:7f6d0f120113 backs out changeset 2:de31bdc76c0d | |
17 | cat: a: No such file or directory |
|
17 | cat: a: No such file or directory | |
18 | # across branch |
|
18 | # across branch | |
19 | adding a |
|
19 | adding a | |
20 | adding b |
|
20 | adding b | |
21 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
21 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
22 | abort: cannot back out change on a different branch |
|
22 | abort: cannot back out change on a different branch | |
23 | adding c |
|
23 | adding c | |
24 | abort: cannot back out change on a different branch |
|
24 | abort: cannot back out change on a different branch | |
25 | # backout with merge |
|
25 | # backout with merge | |
26 | adding a |
|
26 | adding a | |
27 | reverting a |
|
27 | reverting a | |
28 | changeset 3:26b8ccb9ad91 backs out changeset 1:5a50a024c182 |
|
28 | changeset 3:26b8ccb9ad91 backs out changeset 1:5a50a024c182 | |
29 | merging with changeset 3:26b8ccb9ad91 |
|
29 | merging with changeset 3:26b8ccb9ad91 | |
30 | merging a |
|
30 | merging a | |
31 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
31 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved | |
32 | (branch merge, don't forget to commit) |
|
32 | (branch merge, don't forget to commit) | |
33 | line 1 |
|
33 | line 1 | |
34 | line 2 |
|
34 | line 2 | |
35 | line 3 |
|
35 | line 3 | |
36 | # backout should not back out subsequent changesets |
|
36 | # backout should not back out subsequent changesets | |
37 | adding a |
|
37 | adding a | |
38 | adding b |
|
38 | adding b | |
39 | reverting a |
|
39 | reverting a | |
40 | changeset 3:3202beb76721 backs out changeset 1:22bca4c721e5 |
|
40 | changeset 3:3202beb76721 backs out changeset 1:22bca4c721e5 | |
41 | the backout changeset is a new head - do not forget to merge |
|
41 | the backout changeset is a new head - do not forget to merge | |
42 | (use "backout --merge" if you want to auto-merge) |
|
42 | (use "backout --merge" if you want to auto-merge) | |
43 | b |
|
43 | b | |
44 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
44 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
45 | adding a |
|
45 | adding a | |
46 | adding b |
|
46 | adding b | |
47 | adding c |
|
47 | adding c | |
48 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
48 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
49 | adding d |
|
49 | adding d | |
50 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
50 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
51 | (branch merge, don't forget to commit) |
|
51 | (branch merge, don't forget to commit) | |
52 | # backout of merge should fail |
|
52 | # backout of merge should fail | |
53 | abort: cannot back out a merge changeset without --parent |
|
53 | abort: cannot back out a merge changeset without --parent | |
54 | # backout of merge with bad parent should fail |
|
54 | # backout of merge with bad parent should fail | |
55 | abort: cb9a9f314b8b is not a parent of b2f3bb92043e |
|
55 | abort: cb9a9f314b8b is not a parent of b2f3bb92043e | |
56 | # backout of non-merge with parent should fail |
|
56 | # backout of non-merge with parent should fail | |
57 | abort: cannot use --parent on non-merge changeset |
|
57 | abort: cannot use --parent on non-merge changeset | |
58 | # backout with valid parent should be ok |
|
58 | # backout with valid parent should be ok | |
59 | removing d |
|
59 | removing d | |
60 | changeset 5:10e5328c8435 backs out changeset 4:b2f3bb92043e |
|
60 | changeset 5:10e5328c8435 backs out changeset 4:b2f3bb92043e | |
61 | rolling back last transaction |
|
61 | rolling back last transaction | |
62 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
62 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
63 | removing c |
|
63 | removing c | |
64 | changeset 5:033590168430 backs out changeset 4:b2f3bb92043e |
|
64 | changeset 5:033590168430 backs out changeset 4:b2f3bb92043e | |
|
65 | # named branches | |||
|
66 | adding default | |||
|
67 | marked working directory as branch branch1 | |||
|
68 | adding file1 | |||
|
69 | marked working directory as branch branch2 | |||
|
70 | adding file2 | |||
|
71 | removing file1 | |||
|
72 | changeset 3:f1c642b1d8e5 backs out changeset 1:bf1602f437f3 | |||
|
73 | the backout changeset is a new head - do not forget to merge | |||
|
74 | (use "backout --merge" if you want to auto-merge) | |||
|
75 | % on branch2 with branch1 not merged, so file1 should still exist: | |||
|
76 | 45bbcd363bf0 (branch2) | |||
|
77 | C default | |||
|
78 | C file1 | |||
|
79 | C file2 | |||
|
80 | % on branch2 with branch1 merged, so file1 should be gone: | |||
|
81 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |||
|
82 | (branch merge, don't forget to commit) | |||
|
83 | 21d4dc6f9a41 (branch2) tip | |||
|
84 | C default | |||
|
85 | C file2 | |||
|
86 | % on branch1, so no file1 and file2: | |||
|
87 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |||
|
88 | f1c642b1d8e5 (branch1) | |||
|
89 | C default |
General Comments 0
You need to be logged in to leave comments.
Login now