comparison tests/test-censor.t @ 51269:db121ddd171e

censor: be more verbose about the other steps too If we informs the user about head checking, we should tell him when the other operation happens too. Otherwise the user can imagine to still be in the head checking part.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Fri, 01 Dec 2023 22:46:46 +0100
parents 622f00b350be
children ceeb8fa23cc8
comparison
equal deleted inserted replaced
51268:622f00b350be 51269:db121ddd171e
77 (this also tests file pattern matching: path relative to cwd case) 77 (this also tests file pattern matching: path relative to cwd case)
78 78
79 $ mkdir -p foo/bar/baz 79 $ mkdir -p foo/bar/baz
80 $ hg --config extensions.censor= --cwd foo/bar/baz censor -r $C2 -t "remove password" ../../../target 80 $ hg --config extensions.censor= --cwd foo/bar/baz censor -r $C2 -t "remove password" ../../../target
81 checking for the censored content in 2 heads 81 checking for the censored content in 2 heads
82 checking for the censored content in the working directory
83 censoring 1 file revision
82 $ hg cat -r $H1 target | head -n 10 84 $ hg cat -r $H1 target | head -n 10
83 Tainted file is now sanitized 85 Tainted file is now sanitized
84 $ hg cat -r $H2 target | head -n 10 86 $ hg cat -r $H2 target | head -n 10
85 Tainted file now super sanitized 87 Tainted file now super sanitized
86 $ hg cat -r $C2 target | head -n 10 88 $ hg cat -r $C2 target | head -n 10
96 98
97 (this also tests file pattern matching: with 'path:' scheme) 99 (this also tests file pattern matching: with 'path:' scheme)
98 100
99 $ hg --config extensions.censor= --cwd foo/bar/baz censor -r $C1 path:target 101 $ hg --config extensions.censor= --cwd foo/bar/baz censor -r $C1 path:target
100 checking for the censored content in 2 heads 102 checking for the censored content in 2 heads
103 checking for the censored content in the working directory
104 censoring 1 file revision
101 $ hg cat -r $H1 target | head -n 10 105 $ hg cat -r $H1 target | head -n 10
102 Tainted file is now sanitized 106 Tainted file is now sanitized
103 $ hg cat -r $H2 target | head -n 10 107 $ hg cat -r $H2 target | head -n 10
104 Tainted file now super sanitized 108 Tainted file now super sanitized
105 $ hg cat -r $C2 target | head -n 10 109 $ hg cat -r $C2 target | head -n 10
236 $ echo 'advanced head H1' > target 240 $ echo 'advanced head H1' > target
237 $ hg ci -m 'advance head H1' target 241 $ hg ci -m 'advance head H1' target
238 $ H1=`hg id --debug -i` 242 $ H1=`hg id --debug -i`
239 $ hg --config extensions.censor= censor -r $C3 target 243 $ hg --config extensions.censor= censor -r $C3 target
240 checking for the censored content in 2 heads 244 checking for the censored content in 2 heads
245 checking for the censored content in the working directory
246 censoring 1 file revision
241 $ hg update -r $H2 247 $ hg update -r $H2
242 1 files updated, 0 files merged, 0 files removed, 0 files unresolved 248 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
243 $ hg merge -r $C3 249 $ hg merge -r $C3
244 merging target 250 merging target
245 0 files updated, 1 files merged, 0 files removed, 0 files unresolved 251 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
270 $ H2=`hg id --debug -i` 276 $ H2=`hg id --debug -i`
271 $ hg update -r "$H2^" 277 $ hg update -r "$H2^"
272 1 files updated, 0 files merged, 0 files removed, 0 files unresolved 278 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
273 $ hg --config extensions.censor= censor -r . target 279 $ hg --config extensions.censor= censor -r . target
274 checking for the censored content in 2 heads 280 checking for the censored content in 2 heads
281 checking for the censored content in the working directory
275 abort: cannot censor working directory 282 abort: cannot censor working directory
276 (clean/delete/update first) 283 (clean/delete/update first)
277 [255] 284 [255]
278 $ hg update -r $H2 285 $ hg update -r $H2
279 1 files updated, 0 files merged, 0 files removed, 0 files unresolved 286 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
284 $ hg rm target 291 $ hg rm target
285 $ hg ci -m 'delete target so it may be censored' 292 $ hg ci -m 'delete target so it may be censored'
286 $ H2=`hg id --debug -i` 293 $ H2=`hg id --debug -i`
287 $ hg --config extensions.censor= censor -r $C4 target 294 $ hg --config extensions.censor= censor -r $C4 target
288 checking for the censored content in 2 heads 295 checking for the censored content in 2 heads
296 checking for the censored content in the working directory
297 censoring 1 file revision
289 $ hg cat -r $C4 target | head -n 10 298 $ hg cat -r $C4 target | head -n 10
290 $ hg cat -r "$H2^^" target | head -n 10 299 $ hg cat -r "$H2^^" target | head -n 10
291 Tainted file now super sanitized 300 Tainted file now super sanitized
292 $ echo 'fresh start' > target 301 $ echo 'fresh start' > target
293 $ hg add target 302 $ hg add target
317 $ hg debugrevlogstats | grep target 326 $ hg debugrevlogstats | grep target
318 rev-count data-size inl type target 327 rev-count data-size inl type target
319 10 ?????? no file target (glob) 328 10 ?????? no file target (glob)
320 $ hg --config extensions.censor= censor -r $C5 target 329 $ hg --config extensions.censor= censor -r $C5 target
321 checking for the censored content in 2 heads 330 checking for the censored content in 2 heads
331 checking for the censored content in the working directory
332 censoring 1 file revision
322 333
323 The important part is for the censor operation to not crash and the repository 334 The important part is for the censor operation to not crash and the repository
324 to not be corrupted. Right now this involve keeping the revlog split. 335 to not be corrupted. Right now this involve keeping the revlog split.
325 336
326 $ hg debugrevlogstats | grep target 337 $ hg debugrevlogstats | grep target
396 $ CLEANREV=$H2 407 $ CLEANREV=$H2
397 $ hg cat -r $REV target | head -n 10 408 $ hg cat -r $REV target | head -n 10
398 Passwords: hunter2hunter2 409 Passwords: hunter2hunter2
399 $ hg --config extensions.censor= censor -r $REV target 410 $ hg --config extensions.censor= censor -r $REV target
400 checking for the censored content in 3 heads 411 checking for the censored content in 3 heads
412 checking for the censored content in the working directory
413 censoring 1 file revision
401 $ hg cat -r $REV target | head -n 10 414 $ hg cat -r $REV target | head -n 10
402 $ hg cat -r $CLEANREV target | head -n 10 415 $ hg cat -r $CLEANREV target | head -n 10
403 Re-sanitized; nothing to see here 416 Re-sanitized; nothing to see here
404 $ hg push -f -r $H2 417 $ hg push -f -r $H2
405 pushing to $TESTTMP/r 418 pushing to $TESTTMP/r
497 Can import bundle where first revision of a file is censored 510 Can import bundle where first revision of a file is censored
498 511
499 $ hg init ../rinit 512 $ hg init ../rinit
500 $ hg --config extensions.censor= censor -r 0 target 513 $ hg --config extensions.censor= censor -r 0 target
501 checking for the censored content in 3 heads 514 checking for the censored content in 3 heads
515 checking for the censored content in the working directory
516 censoring 1 file revision
502 $ hg bundle -r 0 --base null ../rinit/initbundle 517 $ hg bundle -r 0 --base null ../rinit/initbundle
503 1 changesets found 518 1 changesets found
504 $ cd ../rinit 519 $ cd ../rinit
505 $ hg unbundle initbundle 520 $ hg unbundle initbundle
506 adding changesets 521 adding changesets
512 $ hg cat -r 0 target | head -n 10 527 $ hg cat -r 0 target | head -n 10
513 528
514 Can skip the head checking steps 529 Can skip the head checking steps
515 530
516 $ hg --config extensions.censor= censor -r 0 --no-check-heads target 531 $ hg --config extensions.censor= censor -r 0 --no-check-heads target
532 checking for the censored content in the working directory
533 censoring 1 file revision
517 534
518 #if revlogv2 535 #if revlogv2
519 536
520 Testing feature that does not work in revlog v1 537 Testing feature that does not work in revlog v1
521 =============================================== 538 ===============================================
552 569
553 $ hg cat -r $B1 target | wc -l 570 $ hg cat -r $B1 target | wc -l
554 *50002 (re) 571 *50002 (re)
555 $ hg --config extensions.censor= censor -r $B1 target 572 $ hg --config extensions.censor= censor -r $B1 target
556 checking for the censored content in 1 heads 573 checking for the censored content in 1 heads
574 checking for the censored content in the working directory
575 censoring 1 file revision
557 $ hg cat -r $B1 target | wc -l 576 $ hg cat -r $B1 target | wc -l
558 *0 (re) 577 *0 (re)
559 578
560 Check the children is fine 579 Check the children is fine
561 580