1 $ echo "[extensions]" >> $HGRCPATH |
|
2 $ echo "mq=" >> $HGRCPATH |
|
3 $ echo "graphlog=" >> $HGRCPATH |
|
4 |
|
5 $ restore() { |
|
6 > hg unbundle -q .hg/strip-backup/* |
|
7 > rm .hg/strip-backup/* |
|
8 > } |
|
9 $ teststrip() { |
|
10 > hg up -C $1 |
|
11 > echo % before update $1, strip $2 |
|
12 > hg parents |
|
13 > hg --traceback strip $2 |
|
14 > echo % after update $1, strip $2 |
|
15 > hg parents |
|
16 > restore |
|
17 > } |
|
18 |
|
19 $ hg init test |
|
20 $ cd test |
|
21 |
|
22 $ echo foo > bar |
|
23 $ hg ci -Ama |
|
24 adding bar |
|
25 |
|
26 $ echo more >> bar |
|
27 $ hg ci -Amb |
|
28 |
|
29 $ echo blah >> bar |
|
30 $ hg ci -Amc |
|
31 |
|
32 $ hg up 1 |
|
33 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
34 $ echo blah >> bar |
|
35 $ hg ci -Amd |
|
36 created new head |
|
37 |
|
38 $ echo final >> bar |
|
39 $ hg ci -Ame |
|
40 |
|
41 $ hg log |
|
42 changeset: 4:443431ffac4f |
|
43 tag: tip |
|
44 user: test |
|
45 date: Thu Jan 01 00:00:00 1970 +0000 |
|
46 summary: e |
|
47 |
|
48 changeset: 3:65bd5f99a4a3 |
|
49 parent: 1:ef3a871183d7 |
|
50 user: test |
|
51 date: Thu Jan 01 00:00:00 1970 +0000 |
|
52 summary: d |
|
53 |
|
54 changeset: 2:264128213d29 |
|
55 user: test |
|
56 date: Thu Jan 01 00:00:00 1970 +0000 |
|
57 summary: c |
|
58 |
|
59 changeset: 1:ef3a871183d7 |
|
60 user: test |
|
61 date: Thu Jan 01 00:00:00 1970 +0000 |
|
62 summary: b |
|
63 |
|
64 changeset: 0:9ab35a2d17cb |
|
65 user: test |
|
66 date: Thu Jan 01 00:00:00 1970 +0000 |
|
67 summary: a |
|
68 |
|
69 |
|
70 $ teststrip 4 4 |
|
71 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
72 % before update 4, strip 4 |
|
73 changeset: 4:443431ffac4f |
|
74 tag: tip |
|
75 user: test |
|
76 date: Thu Jan 01 00:00:00 1970 +0000 |
|
77 summary: e |
|
78 |
|
79 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
80 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob) |
|
81 % after update 4, strip 4 |
|
82 changeset: 3:65bd5f99a4a3 |
|
83 tag: tip |
|
84 parent: 1:ef3a871183d7 |
|
85 user: test |
|
86 date: Thu Jan 01 00:00:00 1970 +0000 |
|
87 summary: d |
|
88 |
|
89 $ teststrip 4 3 |
|
90 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
91 % before update 4, strip 3 |
|
92 changeset: 4:443431ffac4f |
|
93 tag: tip |
|
94 user: test |
|
95 date: Thu Jan 01 00:00:00 1970 +0000 |
|
96 summary: e |
|
97 |
|
98 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
99 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob) |
|
100 % after update 4, strip 3 |
|
101 changeset: 1:ef3a871183d7 |
|
102 user: test |
|
103 date: Thu Jan 01 00:00:00 1970 +0000 |
|
104 summary: b |
|
105 |
|
106 $ teststrip 1 4 |
|
107 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
108 % before update 1, strip 4 |
|
109 changeset: 1:ef3a871183d7 |
|
110 user: test |
|
111 date: Thu Jan 01 00:00:00 1970 +0000 |
|
112 summary: b |
|
113 |
|
114 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob) |
|
115 % after update 1, strip 4 |
|
116 changeset: 1:ef3a871183d7 |
|
117 user: test |
|
118 date: Thu Jan 01 00:00:00 1970 +0000 |
|
119 summary: b |
|
120 |
|
121 $ teststrip 4 2 |
|
122 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
123 % before update 4, strip 2 |
|
124 changeset: 4:443431ffac4f |
|
125 tag: tip |
|
126 user: test |
|
127 date: Thu Jan 01 00:00:00 1970 +0000 |
|
128 summary: e |
|
129 |
|
130 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob) |
|
131 % after update 4, strip 2 |
|
132 changeset: 3:443431ffac4f |
|
133 tag: tip |
|
134 user: test |
|
135 date: Thu Jan 01 00:00:00 1970 +0000 |
|
136 summary: e |
|
137 |
|
138 $ teststrip 4 1 |
|
139 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
140 % before update 4, strip 1 |
|
141 changeset: 4:264128213d29 |
|
142 tag: tip |
|
143 parent: 1:ef3a871183d7 |
|
144 user: test |
|
145 date: Thu Jan 01 00:00:00 1970 +0000 |
|
146 summary: c |
|
147 |
|
148 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
149 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob) |
|
150 % after update 4, strip 1 |
|
151 changeset: 0:9ab35a2d17cb |
|
152 tag: tip |
|
153 user: test |
|
154 date: Thu Jan 01 00:00:00 1970 +0000 |
|
155 summary: a |
|
156 |
|
157 $ teststrip null 4 |
|
158 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
159 % before update null, strip 4 |
|
160 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob) |
|
161 % after update null, strip 4 |
|
162 |
|
163 $ hg log |
|
164 changeset: 4:264128213d29 |
|
165 tag: tip |
|
166 parent: 1:ef3a871183d7 |
|
167 user: test |
|
168 date: Thu Jan 01 00:00:00 1970 +0000 |
|
169 summary: c |
|
170 |
|
171 changeset: 3:443431ffac4f |
|
172 user: test |
|
173 date: Thu Jan 01 00:00:00 1970 +0000 |
|
174 summary: e |
|
175 |
|
176 changeset: 2:65bd5f99a4a3 |
|
177 user: test |
|
178 date: Thu Jan 01 00:00:00 1970 +0000 |
|
179 summary: d |
|
180 |
|
181 changeset: 1:ef3a871183d7 |
|
182 user: test |
|
183 date: Thu Jan 01 00:00:00 1970 +0000 |
|
184 summary: b |
|
185 |
|
186 changeset: 0:9ab35a2d17cb |
|
187 user: test |
|
188 date: Thu Jan 01 00:00:00 1970 +0000 |
|
189 summary: a |
|
190 |
|
191 |
|
192 $ hg up -C 2 |
|
193 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
194 $ hg merge 4 |
|
195 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
196 (branch merge, don't forget to commit) |
|
197 |
|
198 before strip of merge parent |
|
199 |
|
200 $ hg parents |
|
201 changeset: 2:65bd5f99a4a3 |
|
202 user: test |
|
203 date: Thu Jan 01 00:00:00 1970 +0000 |
|
204 summary: d |
|
205 |
|
206 changeset: 4:264128213d29 |
|
207 tag: tip |
|
208 parent: 1:ef3a871183d7 |
|
209 user: test |
|
210 date: Thu Jan 01 00:00:00 1970 +0000 |
|
211 summary: c |
|
212 |
|
213 $ hg strip 4 |
|
214 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
215 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob) |
|
216 |
|
217 after strip of merge parent |
|
218 |
|
219 $ hg parents |
|
220 changeset: 1:ef3a871183d7 |
|
221 user: test |
|
222 date: Thu Jan 01 00:00:00 1970 +0000 |
|
223 summary: b |
|
224 |
|
225 $ restore |
|
226 |
|
227 $ hg up |
|
228 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
229 $ hg glog |
|
230 @ changeset: 4:264128213d29 |
|
231 | tag: tip |
|
232 | parent: 1:ef3a871183d7 |
|
233 | user: test |
|
234 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
235 | summary: c |
|
236 | |
|
237 | o changeset: 3:443431ffac4f |
|
238 | | user: test |
|
239 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
240 | | summary: e |
|
241 | | |
|
242 | o changeset: 2:65bd5f99a4a3 |
|
243 |/ user: test |
|
244 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
245 | summary: d |
|
246 | |
|
247 o changeset: 1:ef3a871183d7 |
|
248 | user: test |
|
249 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
250 | summary: b |
|
251 | |
|
252 o changeset: 0:9ab35a2d17cb |
|
253 user: test |
|
254 date: Thu Jan 01 00:00:00 1970 +0000 |
|
255 summary: a |
|
256 |
|
257 |
|
258 2 is parent of 3, only one strip should happen |
|
259 |
|
260 $ hg strip "roots(2)" 3 |
|
261 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob) |
|
262 $ hg glog |
|
263 @ changeset: 2:264128213d29 |
|
264 | tag: tip |
|
265 | user: test |
|
266 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
267 | summary: c |
|
268 | |
|
269 o changeset: 1:ef3a871183d7 |
|
270 | user: test |
|
271 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
272 | summary: b |
|
273 | |
|
274 o changeset: 0:9ab35a2d17cb |
|
275 user: test |
|
276 date: Thu Jan 01 00:00:00 1970 +0000 |
|
277 summary: a |
|
278 |
|
279 $ restore |
|
280 $ hg glog |
|
281 o changeset: 4:443431ffac4f |
|
282 | tag: tip |
|
283 | user: test |
|
284 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
285 | summary: e |
|
286 | |
|
287 o changeset: 3:65bd5f99a4a3 |
|
288 | parent: 1:ef3a871183d7 |
|
289 | user: test |
|
290 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
291 | summary: d |
|
292 | |
|
293 | @ changeset: 2:264128213d29 |
|
294 |/ user: test |
|
295 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
296 | summary: c |
|
297 | |
|
298 o changeset: 1:ef3a871183d7 |
|
299 | user: test |
|
300 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
301 | summary: b |
|
302 | |
|
303 o changeset: 0:9ab35a2d17cb |
|
304 user: test |
|
305 date: Thu Jan 01 00:00:00 1970 +0000 |
|
306 summary: a |
|
307 |
|
308 |
|
309 2 different branches: 2 strips |
|
310 |
|
311 $ hg strip 2 4 |
|
312 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
313 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob) |
|
314 $ hg glog |
|
315 o changeset: 2:65bd5f99a4a3 |
|
316 | tag: tip |
|
317 | user: test |
|
318 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
319 | summary: d |
|
320 | |
|
321 @ changeset: 1:ef3a871183d7 |
|
322 | user: test |
|
323 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
324 | summary: b |
|
325 | |
|
326 o changeset: 0:9ab35a2d17cb |
|
327 user: test |
|
328 date: Thu Jan 01 00:00:00 1970 +0000 |
|
329 summary: a |
|
330 |
|
331 $ restore |
|
332 |
|
333 2 different branches and a common ancestor: 1 strip |
|
334 |
|
335 $ hg strip 1 "2|4" |
|
336 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
337 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob) |
|
338 $ restore |
|
339 |
|
340 stripping an empty revset |
|
341 |
|
342 $ hg strip "1 and not 1" |
|
343 abort: empty revision set |
|
344 [255] |
|
345 |
|
346 remove branchy history for qimport tests |
|
347 |
|
348 $ hg strip 3 |
|
349 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob) |
|
350 |
|
351 |
|
352 strip of applied mq should cleanup status file |
|
353 |
|
354 $ hg up -C 3 |
|
355 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
356 $ echo fooagain >> bar |
|
357 $ hg ci -mf |
|
358 $ hg qimport -r tip:2 |
|
359 |
|
360 applied patches before strip |
|
361 |
|
362 $ hg qapplied |
|
363 2.diff |
|
364 3.diff |
|
365 4.diff |
|
366 |
|
367 stripping revision in queue |
|
368 |
|
369 $ hg strip 3 |
|
370 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
371 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob) |
|
372 |
|
373 applied patches after stripping rev in queue |
|
374 |
|
375 $ hg qapplied |
|
376 2.diff |
|
377 |
|
378 stripping ancestor of queue |
|
379 |
|
380 $ hg strip 1 |
|
381 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
382 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob) |
|
383 |
|
384 applied patches after stripping ancestor of queue |
|
385 |
|
386 $ hg qapplied |
|
387 |
|
388 Verify strip protects against stripping wc parent when there are uncommited mods |
|
389 |
|
390 $ echo b > b |
|
391 $ hg add b |
|
392 $ hg ci -m 'b' |
|
393 $ hg log --graph |
|
394 @ changeset: 1:7519abd79d14 |
|
395 | tag: tip |
|
396 | user: test |
|
397 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
398 | summary: b |
|
399 | |
|
400 o changeset: 0:9ab35a2d17cb |
|
401 user: test |
|
402 date: Thu Jan 01 00:00:00 1970 +0000 |
|
403 summary: a |
|
404 |
|
405 |
|
406 $ echo c > b |
|
407 $ echo c > bar |
|
408 $ hg strip tip |
|
409 abort: local changes found |
|
410 [255] |
|
411 $ hg strip tip --keep |
|
412 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob) |
|
413 $ hg log --graph |
|
414 @ changeset: 0:9ab35a2d17cb |
|
415 tag: tip |
|
416 user: test |
|
417 date: Thu Jan 01 00:00:00 1970 +0000 |
|
418 summary: a |
|
419 |
|
420 $ hg status |
|
421 M bar |
|
422 ? b |
|
423 |
|
424 Strip adds, removes, modifies with --keep |
|
425 |
|
426 $ touch b |
|
427 $ hg add b |
|
428 $ hg commit -mb |
|
429 $ touch c |
|
430 |
|
431 ... with a clean working dir |
|
432 |
|
433 $ hg add c |
|
434 $ hg rm bar |
|
435 $ hg commit -mc |
|
436 $ hg status |
|
437 $ hg strip --keep tip |
|
438 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob) |
|
439 $ hg status |
|
440 ! bar |
|
441 ? c |
|
442 |
|
443 ... with a dirty working dir |
|
444 |
|
445 $ hg add c |
|
446 $ hg rm bar |
|
447 $ hg commit -mc |
|
448 $ hg status |
|
449 $ echo b > b |
|
450 $ echo d > d |
|
451 $ hg strip --keep tip |
|
452 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob) |
|
453 $ hg status |
|
454 M b |
|
455 ! bar |
|
456 ? c |
|
457 ? d |
|
458 $ cd .. |
|
459 |
|
460 stripping many nodes on a complex graph (issue3299) |
|
461 |
|
462 $ hg init issue3299 |
|
463 $ cd issue3299 |
|
464 $ hg debugbuilddag '@a.:a@b.:b.:x<a@a.:a<b@b.:b<a@a.:a' |
|
465 $ hg strip 'not ancestors(x)' |
|
466 saved backup bundle to $TESTTMP/issue3299/.hg/strip-backup/*-backup.hg (glob) |
|
467 |
|
468 test hg strip -B bookmark |
|
469 |
|
470 $ cd .. |
|
471 $ hg init bookmarks |
|
472 $ cd bookmarks |
|
473 $ hg debugbuilddag '..<2.*1/2:m<2+3:c<m+3:a<2.:b' |
|
474 $ hg bookmark -r 'a' 'todelete' |
|
475 $ hg bookmark -r 'b' 'B' |
|
476 $ hg bookmark -r 'b' 'nostrip' |
|
477 $ hg bookmark -r 'c' 'delete' |
|
478 $ hg up -C todelete |
|
479 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
480 $ hg strip -B nostrip |
|
481 bookmark 'nostrip' deleted |
|
482 abort: empty revision set |
|
483 [255] |
|
484 $ hg strip -B todelete |
|
485 bookmark 'todelete' deleted |
|
486 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
487 saved backup bundle to $TESTTMP/bookmarks/.hg/strip-backup/*-backup.hg (glob) |
|
488 $ hg id -ir dcbb326fdec2 |
|
489 abort: unknown revision 'dcbb326fdec2'! |
|
490 [255] |
|
491 $ hg id -ir d62d843c9a01 |
|
492 d62d843c9a01 |
|
493 $ hg bookmarks |
|
494 B 9:ff43616e5d0f |
|
495 delete 6:2702dd0c91e7 |
|
496 $ hg strip -B delete |
|
497 bookmark 'delete' deleted |
|
498 saved backup bundle to $TESTTMP/bookmarks/.hg/strip-backup/*-backup.hg (glob) |
|
499 $ hg id -ir 6:2702dd0c91e7 |
|
500 abort: unknown revision '2702dd0c91e7'! |
|
501 [255] |
|
502 |
|
503 $ cd .. |
|