comparison tests/test-pick.t @ 4484:302cd64f71e1 stable

tests: rename test-grab to test-pick This match the new command name.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Wed, 10 Apr 2019 15:47:28 +0200
parents tests/test-grab.t@424b498aac00
children e3785a8d0712
comparison
equal deleted inserted replaced
4483:7978230faa32 4484:302cd64f71e1
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
31 (some details hidden, use --verbose to show complete help)
32
33 $ mkcommit a
34 $ mkcommit b
35 $ mkcommit c
36
37 $ hg glog
38 @ 2:4538525df7e2 add c
39 |
40 o 1:7c3bad9141dc add b
41 |
42 o 0:1f0dee641bb7 add a
43
44
45 Grabbing an ancestor
46
47 $ hg pick -r 7c3bad9141dc
48 abort: cannot pick an ancestor revision
49 [255]
50
51 Grabbing the working directory parent
52
53 $ hg pick -r .
54 abort: cannot pick an ancestor revision
55 [255]
56
57 Specifying multiple revisions to pick
58
59 $ hg pick 1f0dee641bb7 -r 7c3bad9141dc
60 abort: specify just one revision
61 [255]
62
63 Specifying no revisions to pick
64
65 $ hg pick
66 abort: empty revision set
67 [255]
68
69 Continuing without interrupted pick
70
71 $ hg pick --continue
72 abort: no interrupted pick state exists
73 [255]
74
75 Aborting without interrupted pick
76
77 $ hg pick --abort
78 abort: no interrupted pick state exists
79 [255]
80
81 Specifying both continue and revs
82
83 $ hg up 1f0dee641bb7
84 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
85 $ hg pick -r 4538525df7e2 --continue
86 abort: cannot specify both --continue and revision
87 [255]
88
89 Making new branch heads
90
91 $ mkcommit x
92 created new head
93 $ mkcommit y
94
95 $ hg glog
96 @ 4:d46dc301d92f add y
97 |
98 o 3:8e224524cd09 add x
99 |
100 | o 2:4538525df7e2 add c
101 | |
102 | o 1:7c3bad9141dc add b
103 |/
104 o 0:1f0dee641bb7 add a
105
106 Grabbing a revision
107
108 $ hg pick 7c3bad9141dc
109 picking 1:7c3bad9141dc "add b"
110 1 new orphan changesets
111 $ hg glog
112 @ 5:7c15c05db6fa add b
113 |
114 o 4:d46dc301d92f add y
115 |
116 o 3:8e224524cd09 add x
117 |
118 | * 2:4538525df7e2 add c
119 | |
120 | x 1:7c3bad9141dc add b
121 |/
122 o 0:1f0dee641bb7 add a
123
124
125 When pick does not create any changes
126
127 $ hg graft -r 4538525df7e2
128 grafting 2:4538525df7e2 "add c"
129
130 $ hg glog
131 @ 6:c4636a81ebeb add c
132 |
133 o 5:7c15c05db6fa add b
134 |
135 o 4:d46dc301d92f add y
136 |
137 o 3:8e224524cd09 add x
138 |
139 | * 2:4538525df7e2 add c
140 | |
141 | x 1:7c3bad9141dc add b
142 |/
143 o 0:1f0dee641bb7 add a
144
145 $ hg pick -r 4538525df7e2
146 picking 2:4538525df7e2 "add c"
147 note: picking 2:4538525df7e2 created no changes to commit
148
149 $ hg glog
150 @ 6:c4636a81ebeb add c
151 |
152 o 5:7c15c05db6fa add b
153 |
154 o 4:d46dc301d92f add y
155 |
156 o 3:8e224524cd09 add x
157 |
158 o 0:1f0dee641bb7 add a
159
160 interrupted pick
161
162 $ hg up d46dc301d92f
163 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
164 $ echo foo > c
165 $ hg ci -Aqm "foo to c"
166 $ hg pick -r c4636a81ebeb
167 picking 6:c4636a81ebeb "add c"
168 merging c
169 warning: conflicts while merging c! (edit, then use 'hg resolve --mark')
170 unresolved merge conflicts (see hg help resolve)
171 [1]
172
173 $ echo foobar > c
174 $ hg resolve --all --mark
175 (no more unresolved files)
176 continue: hg pick --continue
177 $ hg pick --continue
178 $ hg glog
179 @ 8:44e155eb95c7 add c
180 |
181 o 7:2ccc03d1d096 foo to c
182 |
183 | o 5:7c15c05db6fa add b
184 |/
185 o 4:d46dc301d92f add y
186 |
187 o 3:8e224524cd09 add x
188 |
189 o 0:1f0dee641bb7 add a
190
191
192 When interrupted pick results in no changes to commit
193
194 $ hg up d46dc301d92f
195 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
196 $ echo bar > c
197 $ hg add c
198 $ hg ci -m "foo to c"
199 created new head
200
201 $ hg up 44e155eb95c7
202 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
203
204 $ hg pick 4e04628911f6
205 picking 9:4e04628911f6 "foo to c"
206 merging c
207 warning: conflicts while merging c! (edit, then use 'hg resolve --mark')
208 unresolved merge conflicts (see hg help resolve)
209 [1]
210 $ echo foobar > c
211 $ hg resolve -m
212 (no more unresolved files)
213 continue: hg pick --continue
214
215 $ hg pick --continue
216 note: picking 9:4e04628911f6 created no changes to commit
217
218 Testing the abort functionality of hg pick
219
220 $ echo foo > b
221 $ hg ci -Aqm "foo to b"
222 $ hg glog -r .^::
223 @ 10:c437988de89f foo to b
224 |
225 o 8:44e155eb95c7 add c
226 |
227 ~
228
229 $ hg pick -r 7c15c05db6fa
230 picking 5:7c15c05db6fa "add b"
231 merging b
232 warning: conflicts while merging b! (edit, then use 'hg resolve --mark')
233 unresolved merge conflicts (see hg help resolve)
234 [1]
235
236 $ hg pick --abort
237 aborting pick, updating to c437988de89f
238
239 $ hg glog
240 @ 10:c437988de89f foo to b
241 |
242 o 8:44e155eb95c7 add c
243 |
244 o 7:2ccc03d1d096 foo to c
245 |
246 | o 5:7c15c05db6fa add b
247 |/
248 o 4:d46dc301d92f add y
249 |
250 o 3:8e224524cd09 add x
251 |
252 o 0:1f0dee641bb7 add a
253
254
255 Trying to pick a public changeset
256
257 $ hg phase -r 7c15c05db6fa -p
258
259 $ hg pick -r 7c15c05db6fa
260 abort: cannot pick public changesets: 7c15c05db6fa
261 (see 'hg help phases' for details)
262 [255]
263
264 $ hg glog
265 @ 10:c437988de89f foo to b
266 |
267 o 8:44e155eb95c7 add c
268 |
269 o 7:2ccc03d1d096 foo to c
270 |
271 | o 5:7c15c05db6fa add b
272 |/
273 o 4:d46dc301d92f add y
274 |
275 o 3:8e224524cd09 add x
276 |
277 o 0:1f0dee641bb7 add a
278
279 Checking phase preservation while picking secret changeset
280
281 In case of merge conflicts
282
283 $ hg phase -r 7c15c05db6fa -s -f
284
285 $ hg pick -r 7c15c05db6fa
286 picking 5:7c15c05db6fa "add b"
287 merging b
288 warning: conflicts while merging b! (edit, then use 'hg resolve --mark')
289 unresolved merge conflicts (see hg help resolve)
290 [1]
291
292 $ echo bar > b
293 $ hg resolve -m
294 (no more unresolved files)
295 continue: hg pick --continue
296
297 $ hg pick --continue
298 $ hg phase -r .
299 11: secret
300
301 No merge conflicts
302
303 $ hg up d46dc301d92f
304 0 files updated, 0 files merged, 3 files removed, 0 files unresolved
305 $ echo foo > l
306 $ hg add l
307 $ hg ci -qm "added l" --secret
308
309 $ hg phase -r .
310 12: secret
311
312 $ hg glog
313 @ 12:508d572e7053 added l
314 |
315 | o 11:10427de9e26e add b
316 | |
317 | o 10:c437988de89f foo to b
318 | |
319 | o 8:44e155eb95c7 add c
320 | |
321 | o 7:2ccc03d1d096 foo to c
322 |/
323 o 4:d46dc301d92f add y
324 |
325 o 3:8e224524cd09 add x
326 |
327 o 0:1f0dee641bb7 add a
328
329 $ hg up 10427de9e26e
330 3 files updated, 0 files merged, 1 files removed, 0 files unresolved
331
332 $ hg pick -r 508d572e7053
333 picking 12:508d572e7053 "added l"
334
335 $ hg phase -r .
336 13: secret