Mercurial > evolve
comparison tests/test-pick.t @ 4512:7a779a288793 mercurial-4.7
test-compat: merge mercurial-4.8 into mercurial-4.7
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Thu, 11 Apr 2019 22:41:41 +0200 |
parents | tests/test-grab.t@424b498aac00 tests/test-grab.t@bdaf34903430 |
children | f54bb6eaf5e6 ac079483153a |
comparison
equal
deleted
inserted
replaced
4359:2cbb9914d227 | 4512:7a779a288793 |
---|---|
1 Test for the pick command | |
2 | |
3 $ cat >> $HGRCPATH <<EOF | |
4 > [alias] | |
5 > glog = log -G -T "{rev}:{node|short} {desc}\n" | |
6 > [extensions] | |
7 > EOF | |
8 $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext3rd/evolve/" >> $HGRCPATH | |
9 | |
10 $ mkcommit() { | |
11 > echo "$1" > "$1" | |
12 > hg add "$1" | |
13 > hg ci -m "add $1" | |
14 > } | |
15 | |
16 $ hg init repo | |
17 $ cd repo | |
18 $ hg help pick | |
19 hg pick [-r] rev | |
20 | |
21 aliases: grab | |
22 | |
23 move a commit on the top of working directory parent and updates to it. | |
24 | |
25 options: | |
26 | |
27 -r --rev REV revision to pick | |
28 -c --continue continue interrupted pick | |
29 -a --abort abort interrupted pick | |
30 -t --tool VALUE specify merge tool | |
31 | |
32 (some details hidden, use --verbose to show complete help) | |
33 | |
34 $ mkcommit a | |
35 $ mkcommit b | |
36 $ mkcommit c | |
37 | |
38 $ hg glog | |
39 @ 2:4538525df7e2 add c | |
40 | | |
41 o 1:7c3bad9141dc add b | |
42 | | |
43 o 0:1f0dee641bb7 add a | |
44 | |
45 | |
46 Grabbing an ancestor | |
47 | |
48 $ hg pick -r 7c3bad9141dc | |
49 abort: cannot pick an ancestor revision | |
50 [255] | |
51 | |
52 Grabbing the working directory parent | |
53 | |
54 $ hg pick -r . | |
55 abort: cannot pick an ancestor revision | |
56 [255] | |
57 | |
58 Specifying multiple revisions to pick | |
59 | |
60 $ hg pick 1f0dee641bb7 -r 7c3bad9141dc | |
61 abort: specify just one revision | |
62 [255] | |
63 | |
64 Specifying no revisions to pick | |
65 | |
66 $ hg pick | |
67 abort: empty revision set | |
68 [255] | |
69 | |
70 Continuing without interrupted pick | |
71 | |
72 $ hg pick --continue | |
73 abort: no interrupted pick state exists | |
74 [255] | |
75 | |
76 Aborting without interrupted pick | |
77 | |
78 $ hg pick --abort | |
79 abort: no interrupted pick state exists | |
80 [255] | |
81 | |
82 Specifying both continue and revs | |
83 | |
84 $ hg up 1f0dee641bb7 | |
85 0 files updated, 0 files merged, 2 files removed, 0 files unresolved | |
86 $ hg pick -r 4538525df7e2 --continue | |
87 abort: cannot specify both --continue and revision | |
88 [255] | |
89 | |
90 Making new branch heads | |
91 | |
92 $ mkcommit x | |
93 created new head | |
94 $ mkcommit y | |
95 | |
96 $ hg glog | |
97 @ 4:d46dc301d92f add y | |
98 | | |
99 o 3:8e224524cd09 add x | |
100 | | |
101 | o 2:4538525df7e2 add c | |
102 | | | |
103 | o 1:7c3bad9141dc add b | |
104 |/ | |
105 o 0:1f0dee641bb7 add a | |
106 | |
107 Grabbing a revision | |
108 | |
109 $ hg pick 7c3bad9141dc | |
110 picking 1:7c3bad9141dc "add b" | |
111 1 new orphan changesets | |
112 $ hg glog | |
113 @ 5:7c15c05db6fa add b | |
114 | | |
115 o 4:d46dc301d92f add y | |
116 | | |
117 o 3:8e224524cd09 add x | |
118 | | |
119 | * 2:4538525df7e2 add c | |
120 | | | |
121 | x 1:7c3bad9141dc add b | |
122 |/ | |
123 o 0:1f0dee641bb7 add a | |
124 | |
125 | |
126 When pick does not create any changes | |
127 | |
128 $ hg graft -r 4538525df7e2 | |
129 grafting 2:4538525df7e2 "add c" | |
130 | |
131 $ hg glog | |
132 @ 6:c4636a81ebeb add c | |
133 | | |
134 o 5:7c15c05db6fa add b | |
135 | | |
136 o 4:d46dc301d92f add y | |
137 | | |
138 o 3:8e224524cd09 add x | |
139 | | |
140 | * 2:4538525df7e2 add c | |
141 | | | |
142 | x 1:7c3bad9141dc add b | |
143 |/ | |
144 o 0:1f0dee641bb7 add a | |
145 | |
146 $ hg pick -r 4538525df7e2 | |
147 picking 2:4538525df7e2 "add c" | |
148 note: picking 2:4538525df7e2 created no changes to commit | |
149 | |
150 $ hg glog | |
151 @ 6:c4636a81ebeb add c | |
152 | | |
153 o 5:7c15c05db6fa add b | |
154 | | |
155 o 4:d46dc301d92f add y | |
156 | | |
157 o 3:8e224524cd09 add x | |
158 | | |
159 o 0:1f0dee641bb7 add a | |
160 | |
161 interrupted pick | |
162 | |
163 $ hg up d46dc301d92f | |
164 0 files updated, 0 files merged, 2 files removed, 0 files unresolved | |
165 $ echo foo > c | |
166 $ hg ci -Aqm "foo to c" | |
167 $ hg pick -r c4636a81ebeb | |
168 picking 6:c4636a81ebeb "add c" | |
169 merging c | |
170 warning: conflicts while merging c! (edit, then use 'hg resolve --mark') | |
171 unresolved merge conflicts (see hg help resolve) | |
172 [1] | |
173 | |
174 $ echo foobar > c | |
175 $ hg resolve --all --mark | |
176 (no more unresolved files) | |
177 continue: hg pick --continue | |
178 $ hg pick --continue | |
179 $ hg glog | |
180 @ 8:44e155eb95c7 add c | |
181 | | |
182 o 7:2ccc03d1d096 foo to c | |
183 | | |
184 | o 5:7c15c05db6fa add b | |
185 |/ | |
186 o 4:d46dc301d92f add y | |
187 | | |
188 o 3:8e224524cd09 add x | |
189 | | |
190 o 0:1f0dee641bb7 add a | |
191 | |
192 | |
193 When interrupted pick results in no changes to commit | |
194 | |
195 $ hg up d46dc301d92f | |
196 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
197 $ echo bar > c | |
198 $ hg add c | |
199 $ hg ci -m "foo to c" | |
200 created new head | |
201 | |
202 $ hg up 44e155eb95c7 | |
203 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
204 | |
205 $ hg pick 4e04628911f6 | |
206 picking 9:4e04628911f6 "foo to c" | |
207 merging c | |
208 warning: conflicts while merging c! (edit, then use 'hg resolve --mark') | |
209 unresolved merge conflicts (see hg help resolve) | |
210 [1] | |
211 $ echo foobar > c | |
212 $ hg resolve -m | |
213 (no more unresolved files) | |
214 continue: hg pick --continue | |
215 | |
216 $ hg pick --continue | |
217 note: picking 9:4e04628911f6 created no changes to commit | |
218 | |
219 Testing the abort functionality of hg pick | |
220 | |
221 $ echo foo > b | |
222 $ hg ci -Aqm "foo to b" | |
223 $ hg glog -r .^:: | |
224 @ 10:c437988de89f foo to b | |
225 | | |
226 o 8:44e155eb95c7 add c | |
227 | | |
228 ~ | |
229 | |
230 $ hg pick -r 7c15c05db6fa | |
231 picking 5:7c15c05db6fa "add b" | |
232 merging b | |
233 warning: conflicts while merging b! (edit, then use 'hg resolve --mark') | |
234 unresolved merge conflicts (see hg help resolve) | |
235 [1] | |
236 | |
237 $ hg pick --abort | |
238 aborting pick, updating to c437988de89f | |
239 | |
240 $ hg glog | |
241 @ 10:c437988de89f foo to b | |
242 | | |
243 o 8:44e155eb95c7 add c | |
244 | | |
245 o 7:2ccc03d1d096 foo to c | |
246 | | |
247 | o 5:7c15c05db6fa add b | |
248 |/ | |
249 o 4:d46dc301d92f add y | |
250 | | |
251 o 3:8e224524cd09 add x | |
252 | | |
253 o 0:1f0dee641bb7 add a | |
254 | |
255 | |
256 Trying to pick a public changeset | |
257 | |
258 $ hg phase -r 7c15c05db6fa -p | |
259 | |
260 $ hg pick -r 7c15c05db6fa | |
261 abort: cannot pick public changesets: 7c15c05db6fa | |
262 (see 'hg help phases' for details) | |
263 [255] | |
264 | |
265 $ hg glog | |
266 @ 10:c437988de89f foo to b | |
267 | | |
268 o 8:44e155eb95c7 add c | |
269 | | |
270 o 7:2ccc03d1d096 foo to c | |
271 | | |
272 | o 5:7c15c05db6fa add b | |
273 |/ | |
274 o 4:d46dc301d92f add y | |
275 | | |
276 o 3:8e224524cd09 add x | |
277 | | |
278 o 0:1f0dee641bb7 add a | |
279 | |
280 Checking phase preservation while picking secret changeset | |
281 | |
282 In case of merge conflicts | |
283 | |
284 $ hg phase -r 7c15c05db6fa -s -f | |
285 | |
286 $ hg pick -r 7c15c05db6fa | |
287 picking 5:7c15c05db6fa "add b" | |
288 merging b | |
289 warning: conflicts while merging b! (edit, then use 'hg resolve --mark') | |
290 unresolved merge conflicts (see hg help resolve) | |
291 [1] | |
292 | |
293 $ echo bar > b | |
294 $ hg resolve -m | |
295 (no more unresolved files) | |
296 continue: hg pick --continue | |
297 | |
298 $ hg pick --continue | |
299 $ hg phase -r . | |
300 11: secret | |
301 | |
302 No merge conflicts | |
303 | |
304 $ hg up d46dc301d92f | |
305 0 files updated, 0 files merged, 3 files removed, 0 files unresolved | |
306 $ echo foo > l | |
307 $ hg add l | |
308 $ hg ci -qm "added l" --secret | |
309 | |
310 $ hg phase -r . | |
311 12: secret | |
312 | |
313 $ hg glog | |
314 @ 12:508d572e7053 added l | |
315 | | |
316 | o 11:10427de9e26e add b | |
317 | | | |
318 | o 10:c437988de89f foo to b | |
319 | | | |
320 | o 8:44e155eb95c7 add c | |
321 | | | |
322 | o 7:2ccc03d1d096 foo to c | |
323 |/ | |
324 o 4:d46dc301d92f add y | |
325 | | |
326 o 3:8e224524cd09 add x | |
327 | | |
328 o 0:1f0dee641bb7 add a | |
329 | |
330 $ hg up 10427de9e26e | |
331 3 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
332 | |
333 $ hg pick -r 508d572e7053 | |
334 picking 12:508d572e7053 "added l" | |
335 | |
336 $ hg phase -r . | |
337 13: secret | |
338 $ cd .. | |
339 | |
340 Check pick behavior regarding working copy branch (issue6089) | |
341 ------------------------------------------------------------- | |
342 | |
343 The branch of the picked changeset should be preserved, and the working copy updated | |
344 | |
345 $ hg init issue6089 | |
346 $ cd issue6089 | |
347 | |
348 $ touch a | |
349 $ hg add a | |
350 $ hg ci -m 'first commit on default' | |
351 | |
352 $ hg branch foo | |
353 marked working directory as branch foo | |
354 (branches are permanent and global, did you want a bookmark?) | |
355 $ touch b | |
356 $ hg add b | |
357 $ hg ci -m 'first commit on foo' | |
358 | |
359 $ hg up default | |
360 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
361 $ echo test > a | |
362 $ hg ci -m 'second commit on default' | |
363 $ hg log -G --template '{node|short}: {branch}\n' --rev 'all()+wdir()' | |
364 o ffffffffffff: default | |
365 | | |
366 @ 5f07cbf7d111: default | |
367 | | |
368 | o 96bb2057779e: foo | |
369 |/ | |
370 o d03a6bcc83cd: default | |
371 | |
372 | |
373 $ hg pick 1 | |
374 picking 1:96bb2057779e "first commit on foo" | |
375 $ hg log --template '{branch}\n' -r tip | |
376 foo | |
377 $ hg branch | |
378 foo | |
379 $ hg log -G --template '{node|short}: {branch}\n' --rev 'all()+wdir()' | |
380 o ffffffffffff: foo | |
381 | | |
382 @ 5344a77549bd: foo | |
383 | | |
384 o 5f07cbf7d111: default | |
385 | | |
386 o d03a6bcc83cd: default | |
387 | |
388 $ cd .. |