comparison tests/test-rebase-detach.t @ 23835:aa4a1672583e

bundles: do not overwrite existing backup bundles (BC) Previously, a backup bundle could overwrite an existing bundle and cause user data loss. For instance, if you have A<-B<-C and strip B, it produces backup bundle B-backup.hg. If you then hg pull -r B B-backup.hg and strip it again, it overwrites the existing B-backup.hg and C is lost. The fix is to add a hash of all the nodes inside that bundle to the filename. Fixed up existing tests and added a new test in test-strip.t
author Durham Goode <durham@fb.com>
date Fri, 09 Jan 2015 10:52:14 -0800
parents 2fb0504b8175
children ef1eb6df7071
comparison
equal deleted inserted replaced
23834:bf07c19b4c82 23835:aa4a1672583e
47 o 0: 'A' 47 o 0: 'A'
48 48
49 $ hg phase --force --secret 3 49 $ hg phase --force --secret 3
50 $ hg rebase -s 3 -d 7 50 $ hg rebase -s 3 -d 7
51 rebasing 3:32af7686d403 "D" 51 rebasing 3:32af7686d403 "D"
52 saved backup bundle to $TESTTMP/a1/.hg/strip-backup/32af7686d403-backup.hg (glob) 52 saved backup bundle to $TESTTMP/a1/.hg/strip-backup/32af7686d403-6f7dface-backup.hg (glob)
53 53
54 $ hg log -G --template "{rev}:{phase} '{desc}' {branches}\n" 54 $ hg log -G --template "{rev}:{phase} '{desc}' {branches}\n"
55 o 7:secret 'D' 55 o 7:secret 'D'
56 | 56 |
57 @ 6:draft 'H' 57 @ 6:draft 'H'
100 o 0: 'A' 100 o 0: 'A'
101 101
102 $ hg rebase -s 2 -d 7 102 $ hg rebase -s 2 -d 7
103 rebasing 2:5fddd98957c8 "C" 103 rebasing 2:5fddd98957c8 "C"
104 rebasing 3:32af7686d403 "D" 104 rebasing 3:32af7686d403 "D"
105 saved backup bundle to $TESTTMP/a2/.hg/strip-backup/5fddd98957c8-backup.hg (glob) 105 saved backup bundle to $TESTTMP/a2/.hg/strip-backup/5fddd98957c8-f9244fa1-backup.hg (glob)
106 106
107 $ hg tglog 107 $ hg tglog
108 o 7: 'D' 108 o 7: 'D'
109 | 109 |
110 o 6: 'C' 110 o 6: 'C'
155 155
156 $ hg rebase -s 1 -d 7 156 $ hg rebase -s 1 -d 7
157 rebasing 1:42ccdea3bb16 "B" 157 rebasing 1:42ccdea3bb16 "B"
158 rebasing 2:5fddd98957c8 "C" 158 rebasing 2:5fddd98957c8 "C"
159 rebasing 3:32af7686d403 "D" 159 rebasing 3:32af7686d403 "D"
160 saved backup bundle to $TESTTMP/a3/.hg/strip-backup/42ccdea3bb16-backup.hg (glob) 160 saved backup bundle to $TESTTMP/a3/.hg/strip-backup/42ccdea3bb16-3cb021d3-backup.hg (glob)
161 161
162 $ hg tglog 162 $ hg tglog
163 o 7: 'D' 163 o 7: 'D'
164 | 164 |
165 o 6: 'C' 165 o 6: 'C'
213 $ hg rebase --collapse -s 2 -d 7 213 $ hg rebase --collapse -s 2 -d 7
214 rebasing 2:5fddd98957c8 "C" 214 rebasing 2:5fddd98957c8 "C"
215 note: rebase of 2:5fddd98957c8 created no changes to commit 215 note: rebase of 2:5fddd98957c8 created no changes to commit
216 rebasing 3:32af7686d403 "D" 216 rebasing 3:32af7686d403 "D"
217 note: rebase of 3:32af7686d403 created no changes to commit 217 note: rebase of 3:32af7686d403 created no changes to commit
218 saved backup bundle to $TESTTMP/a4/.hg/strip-backup/5fddd98957c8-backup.hg (glob) 218 saved backup bundle to $TESTTMP/a4/.hg/strip-backup/5fddd98957c8-f9244fa1-backup.hg (glob)
219 219
220 $ hg log -G --template "{rev}:{phase} '{desc}' {branches}\n" 220 $ hg log -G --template "{rev}:{phase} '{desc}' {branches}\n"
221 o 6:secret 'Collapsed revision 221 o 6:secret 'Collapsed revision
222 | * C 222 | * C
223 | * D' 223 | * D'
275 275
276 $ hg rebase -s 1 -d tip 276 $ hg rebase -s 1 -d tip
277 rebasing 1:42ccdea3bb16 "B" 277 rebasing 1:42ccdea3bb16 "B"
278 rebasing 2:5fddd98957c8 "C" 278 rebasing 2:5fddd98957c8 "C"
279 rebasing 3:32af7686d403 "D" 279 rebasing 3:32af7686d403 "D"
280 saved backup bundle to $TESTTMP/a5/.hg/strip-backup/42ccdea3bb16-backup.hg (glob) 280 saved backup bundle to $TESTTMP/a5/.hg/strip-backup/42ccdea3bb16-3cb021d3-backup.hg (glob)
281 281
282 $ hg tglog 282 $ hg tglog
283 o 8: 'D' 283 o 8: 'D'
284 | 284 |
285 o 7: 'C' 285 o 7: 'C'
300 300
301 301
302 $ hg rebase -d 5 -s 7 302 $ hg rebase -d 5 -s 7
303 rebasing 7:13547172c9c0 "C" 303 rebasing 7:13547172c9c0 "C"
304 rebasing 8:4e27a76c371a "D" (tip) 304 rebasing 8:4e27a76c371a "D" (tip)
305 saved backup bundle to $TESTTMP/a5/.hg/strip-backup/13547172c9c0-backup.hg (glob) 305 saved backup bundle to $TESTTMP/a5/.hg/strip-backup/13547172c9c0-35685ded-backup.hg (glob)
306 $ hg tglog 306 $ hg tglog
307 o 8: 'D' 307 o 8: 'D'
308 | 308 |
309 o 7: 'C' 309 o 7: 'C'
310 | 310 |
344 note: rebase of 8:9790e768172d created no changes to commit 344 note: rebase of 8:9790e768172d created no changes to commit
345 rebasing 9:5d7b11f5fb97 "Merge" 345 rebasing 9:5d7b11f5fb97 "Merge"
346 note: rebase of 9:5d7b11f5fb97 created no changes to commit 346 note: rebase of 9:5d7b11f5fb97 created no changes to commit
347 rebasing 10:9427d4d5af81 "J" (tip) 347 rebasing 10:9427d4d5af81 "J" (tip)
348 note: rebase of 10:9427d4d5af81 created no changes to commit 348 note: rebase of 10:9427d4d5af81 created no changes to commit
349 saved backup bundle to $TESTTMP/a6/.hg/strip-backup/9790e768172d-backup.hg (glob) 349 saved backup bundle to $TESTTMP/a6/.hg/strip-backup/9790e768172d-c2111e9d-backup.hg (glob)
350 350
351 $ hg tglog 351 $ hg tglog
352 @ 8: 'Collapsed revision 352 @ 8: 'Collapsed revision
353 | * I 353 | * I
354 | * Merge 354 | * Merge
398 $ hg resolve --all -t internal:local 398 $ hg resolve --all -t internal:local
399 (no more unresolved files) 399 (no more unresolved files)
400 $ hg rebase -c 400 $ hg rebase -c
401 rebasing 8:6215fafa5447 "H2" (tip) 401 rebasing 8:6215fafa5447 "H2" (tip)
402 note: rebase of 8:6215fafa5447 created no changes to commit 402 note: rebase of 8:6215fafa5447 created no changes to commit
403 saved backup bundle to $TESTTMP/a7/.hg/strip-backup/6215fafa5447-backup.hg (glob) 403 saved backup bundle to $TESTTMP/a7/.hg/strip-backup/6215fafa5447-5804ebd5-backup.hg (glob)
404 $ hg log -G --template "{rev}:{phase} '{desc}' {branches}\n" 404 $ hg log -G --template "{rev}:{phase} '{desc}' {branches}\n"
405 @ 7:draft 'H' 405 @ 7:draft 'H'
406 | 406 |
407 | o 6:draft 'G' 407 | o 6:draft 'G'
408 |/| 408 |/|