##// END OF EJS Templates
test-rebase-abort: add test from issue4009...
Jordi Gutiérrez Hermoso -
r25069:01ad8daa stable
parent child Browse files
Show More
@@ -1,243 +1,290 b''
1 $ cat >> $HGRCPATH <<EOF
1 $ cat >> $HGRCPATH <<EOF
2 > [extensions]
2 > [extensions]
3 > rebase=
3 > rebase=
4 >
4 >
5 > [phases]
5 > [phases]
6 > publish=False
6 > publish=False
7 >
7 >
8 > [alias]
8 > [alias]
9 > tglog = log -G --template "{rev}:{phase} '{desc}' {branches}\n"
9 > tglog = log -G --template "{rev}:{phase} '{desc}' {branches}\n"
10 > EOF
10 > EOF
11
11
12
12
13 $ hg init a
13 $ hg init a
14 $ cd a
14 $ cd a
15
15
16 $ touch .hg/rebasestate
16 $ touch .hg/rebasestate
17 $ hg sum
17 $ hg sum
18 parent: -1:000000000000 tip (empty repository)
18 parent: -1:000000000000 tip (empty repository)
19 branch: default
19 branch: default
20 commit: (clean)
20 commit: (clean)
21 update: (current)
21 update: (current)
22 abort: .hg/rebasestate is incomplete
22 abort: .hg/rebasestate is incomplete
23 [255]
23 [255]
24 $ rm .hg/rebasestate
24 $ rm .hg/rebasestate
25
25
26 $ echo c1 > common
26 $ echo c1 > common
27 $ hg add common
27 $ hg add common
28 $ hg ci -m C1
28 $ hg ci -m C1
29
29
30 $ echo c2 >> common
30 $ echo c2 >> common
31 $ hg ci -m C2
31 $ hg ci -m C2
32
32
33 $ echo c3 >> common
33 $ echo c3 >> common
34 $ hg ci -m C3
34 $ hg ci -m C3
35
35
36 $ hg up -q -C 1
36 $ hg up -q -C 1
37
37
38 $ echo l1 >> extra
38 $ echo l1 >> extra
39 $ hg add extra
39 $ hg add extra
40 $ hg ci -m L1
40 $ hg ci -m L1
41 created new head
41 created new head
42
42
43 $ sed -e 's/c2/l2/' common > common.new
43 $ sed -e 's/c2/l2/' common > common.new
44 $ mv common.new common
44 $ mv common.new common
45 $ hg ci -m L2
45 $ hg ci -m L2
46
46
47 $ hg phase --force --secret 2
47 $ hg phase --force --secret 2
48
48
49 $ hg tglog
49 $ hg tglog
50 @ 4:draft 'L2'
50 @ 4:draft 'L2'
51 |
51 |
52 o 3:draft 'L1'
52 o 3:draft 'L1'
53 |
53 |
54 | o 2:secret 'C3'
54 | o 2:secret 'C3'
55 |/
55 |/
56 o 1:draft 'C2'
56 o 1:draft 'C2'
57 |
57 |
58 o 0:draft 'C1'
58 o 0:draft 'C1'
59
59
60
60
61 Conflicting rebase:
61 Conflicting rebase:
62
62
63 $ hg rebase -s 3 -d 2
63 $ hg rebase -s 3 -d 2
64 rebasing 3:3163e20567cc "L1"
64 rebasing 3:3163e20567cc "L1"
65 rebasing 4:46f0b057b5c0 "L2" (tip)
65 rebasing 4:46f0b057b5c0 "L2" (tip)
66 merging common
66 merging common
67 warning: conflicts during merge.
67 warning: conflicts during merge.
68 merging common incomplete! (edit conflicts, then use 'hg resolve --mark')
68 merging common incomplete! (edit conflicts, then use 'hg resolve --mark')
69 unresolved conflicts (see hg resolve, then hg rebase --continue)
69 unresolved conflicts (see hg resolve, then hg rebase --continue)
70 [1]
70 [1]
71
71
72 Abort:
72 Abort:
73
73
74 $ hg rebase --abort
74 $ hg rebase --abort
75 saved backup bundle to $TESTTMP/a/.hg/strip-backup/3e046f2ecedb-6beef7d5-backup.hg (glob)
75 saved backup bundle to $TESTTMP/a/.hg/strip-backup/3e046f2ecedb-6beef7d5-backup.hg (glob)
76 rebase aborted
76 rebase aborted
77
77
78 $ hg tglog
78 $ hg tglog
79 @ 4:draft 'L2'
79 @ 4:draft 'L2'
80 |
80 |
81 o 3:draft 'L1'
81 o 3:draft 'L1'
82 |
82 |
83 | o 2:secret 'C3'
83 | o 2:secret 'C3'
84 |/
84 |/
85 o 1:draft 'C2'
85 o 1:draft 'C2'
86 |
86 |
87 o 0:draft 'C1'
87 o 0:draft 'C1'
88
88
89 Test safety for inconsistent rebase state, which may be created (and
89 Test safety for inconsistent rebase state, which may be created (and
90 forgotten) by Mercurial earlier than 2.7. This emulates Mercurial
90 forgotten) by Mercurial earlier than 2.7. This emulates Mercurial
91 earlier than 2.7 by renaming ".hg/rebasestate" temporarily.
91 earlier than 2.7 by renaming ".hg/rebasestate" temporarily.
92
92
93 $ hg rebase -s 3 -d 2
93 $ hg rebase -s 3 -d 2
94 rebasing 3:3163e20567cc "L1"
94 rebasing 3:3163e20567cc "L1"
95 rebasing 4:46f0b057b5c0 "L2" (tip)
95 rebasing 4:46f0b057b5c0 "L2" (tip)
96 merging common
96 merging common
97 warning: conflicts during merge.
97 warning: conflicts during merge.
98 merging common incomplete! (edit conflicts, then use 'hg resolve --mark')
98 merging common incomplete! (edit conflicts, then use 'hg resolve --mark')
99 unresolved conflicts (see hg resolve, then hg rebase --continue)
99 unresolved conflicts (see hg resolve, then hg rebase --continue)
100 [1]
100 [1]
101
101
102 $ mv .hg/rebasestate .hg/rebasestate.back
102 $ mv .hg/rebasestate .hg/rebasestate.back
103 $ hg update --quiet --clean 2
103 $ hg update --quiet --clean 2
104 $ hg --config extensions.mq= strip --quiet "destination()"
104 $ hg --config extensions.mq= strip --quiet "destination()"
105 $ mv .hg/rebasestate.back .hg/rebasestate
105 $ mv .hg/rebasestate.back .hg/rebasestate
106
106
107 $ hg rebase --continue
107 $ hg rebase --continue
108 abort: cannot continue inconsistent rebase
108 abort: cannot continue inconsistent rebase
109 (use "hg rebase --abort" to clear broken state)
109 (use "hg rebase --abort" to clear broken state)
110 [255]
110 [255]
111 $ hg summary | grep '^rebase: '
111 $ hg summary | grep '^rebase: '
112 rebase: (use "hg rebase --abort" to clear broken state)
112 rebase: (use "hg rebase --abort" to clear broken state)
113 $ hg rebase --abort
113 $ hg rebase --abort
114 rebase aborted (no revision is removed, only broken state is cleared)
114 rebase aborted (no revision is removed, only broken state is cleared)
115
115
116 $ cd ..
116 $ cd ..
117
117
118
118
119 Construct new repo:
119 Construct new repo:
120
120
121 $ hg init b
121 $ hg init b
122 $ cd b
122 $ cd b
123
123
124 $ echo a > a
124 $ echo a > a
125 $ hg ci -Am A
125 $ hg ci -Am A
126 adding a
126 adding a
127
127
128 $ echo b > b
128 $ echo b > b
129 $ hg ci -Am B
129 $ hg ci -Am B
130 adding b
130 adding b
131
131
132 $ echo c > c
132 $ echo c > c
133 $ hg ci -Am C
133 $ hg ci -Am C
134 adding c
134 adding c
135
135
136 $ hg up -q 0
136 $ hg up -q 0
137
137
138 $ echo b > b
138 $ echo b > b
139 $ hg ci -Am 'B bis'
139 $ hg ci -Am 'B bis'
140 adding b
140 adding b
141 created new head
141 created new head
142
142
143 $ echo c1 > c
143 $ echo c1 > c
144 $ hg ci -Am C1
144 $ hg ci -Am C1
145 adding c
145 adding c
146
146
147 $ hg phase --force --secret 1
147 $ hg phase --force --secret 1
148 $ hg phase --public 1
148 $ hg phase --public 1
149
149
150 Rebase and abort without generating new changesets:
150 Rebase and abort without generating new changesets:
151
151
152 $ hg tglog
152 $ hg tglog
153 @ 4:draft 'C1'
153 @ 4:draft 'C1'
154 |
154 |
155 o 3:draft 'B bis'
155 o 3:draft 'B bis'
156 |
156 |
157 | o 2:secret 'C'
157 | o 2:secret 'C'
158 | |
158 | |
159 | o 1:public 'B'
159 | o 1:public 'B'
160 |/
160 |/
161 o 0:public 'A'
161 o 0:public 'A'
162
162
163 $ hg rebase -b 4 -d 2
163 $ hg rebase -b 4 -d 2
164 rebasing 3:a6484957d6b9 "B bis"
164 rebasing 3:a6484957d6b9 "B bis"
165 note: rebase of 3:a6484957d6b9 created no changes to commit
165 note: rebase of 3:a6484957d6b9 created no changes to commit
166 rebasing 4:145842775fec "C1" (tip)
166 rebasing 4:145842775fec "C1" (tip)
167 merging c
167 merging c
168 warning: conflicts during merge.
168 warning: conflicts during merge.
169 merging c incomplete! (edit conflicts, then use 'hg resolve --mark')
169 merging c incomplete! (edit conflicts, then use 'hg resolve --mark')
170 unresolved conflicts (see hg resolve, then hg rebase --continue)
170 unresolved conflicts (see hg resolve, then hg rebase --continue)
171 [1]
171 [1]
172
172
173 $ hg tglog
173 $ hg tglog
174 @ 4:draft 'C1'
174 @ 4:draft 'C1'
175 |
175 |
176 o 3:draft 'B bis'
176 o 3:draft 'B bis'
177 |
177 |
178 | @ 2:secret 'C'
178 | @ 2:secret 'C'
179 | |
179 | |
180 | o 1:public 'B'
180 | o 1:public 'B'
181 |/
181 |/
182 o 0:public 'A'
182 o 0:public 'A'
183
183
184 $ hg rebase -a
184 $ hg rebase -a
185 rebase aborted
185 rebase aborted
186
186
187 $ hg tglog
187 $ hg tglog
188 @ 4:draft 'C1'
188 @ 4:draft 'C1'
189 |
189 |
190 o 3:draft 'B bis'
190 o 3:draft 'B bis'
191 |
191 |
192 | o 2:secret 'C'
192 | o 2:secret 'C'
193 | |
193 | |
194 | o 1:public 'B'
194 | o 1:public 'B'
195 |/
195 |/
196 o 0:public 'A'
196 o 0:public 'A'
197
197
198
198
199 $ cd ..
199 $ cd ..
200
200
201 rebase abort should not leave working copy in a merge state if tip-1 is public
201 rebase abort should not leave working copy in a merge state if tip-1 is public
202 (issue4082)
202 (issue4082)
203
203
204 $ hg init abortpublic
204 $ hg init abortpublic
205 $ cd abortpublic
205 $ cd abortpublic
206 $ echo a > a && hg ci -Aqm a
206 $ echo a > a && hg ci -Aqm a
207 $ hg book master
207 $ hg book master
208 $ hg book foo
208 $ hg book foo
209 $ echo b > b && hg ci -Aqm b
209 $ echo b > b && hg ci -Aqm b
210 $ hg up -q master
210 $ hg up -q master
211 $ echo c > c && hg ci -Aqm c
211 $ echo c > c && hg ci -Aqm c
212 $ hg phase -p -r .
212 $ hg phase -p -r .
213 $ hg up -q foo
213 $ hg up -q foo
214 $ echo C > c && hg ci -Aqm C
214 $ echo C > c && hg ci -Aqm C
215 $ hg log -G --template "{rev} {desc} {bookmarks}"
215 $ hg log -G --template "{rev} {desc} {bookmarks}"
216 @ 3 C foo
216 @ 3 C foo
217 |
217 |
218 | o 2 c master
218 | o 2 c master
219 | |
219 | |
220 o | 1 b
220 o | 1 b
221 |/
221 |/
222 o 0 a
222 o 0 a
223
223
224
224
225 $ hg rebase -d master -r foo
225 $ hg rebase -d master -r foo
226 rebasing 3:6c0f977a22d8 "C" (tip foo)
226 rebasing 3:6c0f977a22d8 "C" (tip foo)
227 merging c
227 merging c
228 warning: conflicts during merge.
228 warning: conflicts during merge.
229 merging c incomplete! (edit conflicts, then use 'hg resolve --mark')
229 merging c incomplete! (edit conflicts, then use 'hg resolve --mark')
230 unresolved conflicts (see hg resolve, then hg rebase --continue)
230 unresolved conflicts (see hg resolve, then hg rebase --continue)
231 [1]
231 [1]
232 $ hg rebase --abort
232 $ hg rebase --abort
233 rebase aborted
233 rebase aborted
234 $ hg log -G --template "{rev} {desc} {bookmarks}"
234 $ hg log -G --template "{rev} {desc} {bookmarks}"
235 @ 3 C foo
235 @ 3 C foo
236 |
236 |
237 | o 2 c master
237 | o 2 c master
238 | |
238 | |
239 o | 1 b
239 o | 1 b
240 |/
240 |/
241 o 0 a
241 o 0 a
242
242
243 $ cd ..
243 $ cd ..
244
245 Make sure we don't clobber changes in the working directory when the
246 user has somehow managed to update to a different revision (issue4009)
247
248 $ hg init noupdate
249 $ cd noupdate
250 $ hg book @
251 $ echo original > a
252 $ hg add a
253 $ hg commit -m a
254 $ echo x > b
255 $ hg add b
256 $ hg commit -m b1
257 $ hg up 0
258 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
259 (leaving bookmark @)
260 $ hg book foo
261 $ echo y > b
262 $ hg add b
263 $ hg commit -m b2
264 created new head
265
266 $ hg rebase -d @ -b foo --tool=internal:fail
267 rebasing 2:070cf4580bb5 "b2" (tip foo)
268 unresolved conflicts (see hg resolve, then hg rebase --continue)
269 [1]
270
271 $ mv .hg/rebasestate ./ # so we're allowed to hg up like in mercurial <2.6.3
272 $ hg up -C 0 # user does other stuff in the repo
273 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
274
275 $ mv rebasestate .hg/ # user upgrades to 2.7
276
277 $ echo new > a
278 $ hg up 1 # user gets an error saying to run hg rebase --abort
279 abort: rebase in progress
280 (use 'hg rebase --continue' or 'hg rebase --abort')
281 [255]
282
283 $ cat a
284 new
285 $ hg rebase --abort
286 rebase aborted
287 $ cat a
288 new
289
290 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now