tests/test-censor.t
changeset 51290 ceeb8fa23cc8
parent 51289 db121ddd171e
child 51371 508fd40dc86a
equal deleted inserted replaced
51289:db121ddd171e 51290:ceeb8fa23cc8
    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
    82   checking for the censored content in the working directory
    83   censoring 1 file revision
    83   censoring 1 file revisions
    84   $ hg cat -r $H1 target | head -n 10
    84   $ hg cat -r $H1 target | head -n 10
    85   Tainted file is now sanitized
    85   Tainted file is now sanitized
    86   $ hg cat -r $H2 target | head -n 10
    86   $ hg cat -r $H2 target | head -n 10
    87   Tainted file now super sanitized
    87   Tainted file now super sanitized
    88   $ hg cat -r $C2 target | head -n 10
    88   $ hg cat -r $C2 target | head -n 10
    99 (this also tests file pattern matching: with 'path:' scheme)
    99 (this also tests file pattern matching: with 'path:' scheme)
   100 
   100 
   101   $ 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
   102   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
   103   checking for the censored content in the working directory
   104   censoring 1 file revision
   104   censoring 1 file revisions
   105   $ hg cat -r $H1 target | head -n 10
   105   $ hg cat -r $H1 target | head -n 10
   106   Tainted file is now sanitized
   106   Tainted file is now sanitized
   107   $ hg cat -r $H2 target | head -n 10
   107   $ hg cat -r $H2 target | head -n 10
   108   Tainted file now super sanitized
   108   Tainted file now super sanitized
   109   $ hg cat -r $C2 target | head -n 10
   109   $ hg cat -r $C2 target | head -n 10
   241   $ hg ci -m 'advance head H1' target
   241   $ hg ci -m 'advance head H1' target
   242   $ H1=`hg id --debug -i`
   242   $ H1=`hg id --debug -i`
   243   $ hg --config extensions.censor= censor -r $C3 target
   243   $ hg --config extensions.censor= censor -r $C3 target
   244   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
   245   checking for the censored content in the working directory
   246   censoring 1 file revision
   246   censoring 1 file revisions
   247   $ hg update -r $H2
   247   $ hg update -r $H2
   248   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
   249   $ hg merge -r $C3
   249   $ hg merge -r $C3
   250   merging target
   250   merging target
   251   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
   292   $ hg ci -m 'delete target so it may be censored'
   292   $ hg ci -m 'delete target so it may be censored'
   293   $ H2=`hg id --debug -i`
   293   $ H2=`hg id --debug -i`
   294   $ hg --config extensions.censor= censor -r $C4 target
   294   $ hg --config extensions.censor= censor -r $C4 target
   295   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
   296   checking for the censored content in the working directory
   297   censoring 1 file revision
   297   censoring 1 file revisions
   298   $ hg cat -r $C4 target | head -n 10
   298   $ hg cat -r $C4 target | head -n 10
   299   $ hg cat -r "$H2^^" target | head -n 10
   299   $ hg cat -r "$H2^^" target | head -n 10
   300   Tainted file now super sanitized
   300   Tainted file now super sanitized
   301   $ echo 'fresh start' > target
   301   $ echo 'fresh start' > target
   302   $ hg add target
   302   $ hg add target
   327   rev-count   data-size inl type      target 
   327   rev-count   data-size inl type      target 
   328          10      ?????? no  file      target (glob)
   328          10      ?????? no  file      target (glob)
   329   $ hg --config extensions.censor= censor -r $C5 target
   329   $ hg --config extensions.censor= censor -r $C5 target
   330   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
   331   checking for the censored content in the working directory
   332   censoring 1 file revision
   332   censoring 1 file revisions
   333 
   333 
   334 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
   335 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.
   336 
   336 
   337   $ hg debugrevlogstats | grep target
   337   $ hg debugrevlogstats | grep target
   408   $ hg cat -r $REV target | head -n 10
   408   $ hg cat -r $REV target | head -n 10
   409   Passwords: hunter2hunter2
   409   Passwords: hunter2hunter2
   410   $ hg --config extensions.censor= censor -r $REV target
   410   $ hg --config extensions.censor= censor -r $REV target
   411   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
   412   checking for the censored content in the working directory
   413   censoring 1 file revision
   413   censoring 1 file revisions
   414   $ hg cat -r $REV target | head -n 10
   414   $ hg cat -r $REV target | head -n 10
   415   $ hg cat -r $CLEANREV target | head -n 10
   415   $ hg cat -r $CLEANREV target | head -n 10
   416   Re-sanitized; nothing to see here
   416   Re-sanitized; nothing to see here
   417   $ hg push -f -r $H2
   417   $ hg push -f -r $H2
   418   pushing to $TESTTMP/r
   418   pushing to $TESTTMP/r
   511 
   511 
   512   $ hg init ../rinit
   512   $ hg init ../rinit
   513   $ hg --config extensions.censor= censor -r 0 target
   513   $ hg --config extensions.censor= censor -r 0 target
   514   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
   515   checking for the censored content in the working directory
   516   censoring 1 file revision
   516   censoring 1 file revisions
   517   $ hg bundle -r 0 --base null ../rinit/initbundle
   517   $ hg bundle -r 0 --base null ../rinit/initbundle
   518   1 changesets found
   518   1 changesets found
   519   $ cd ../rinit
   519   $ cd ../rinit
   520   $ hg unbundle initbundle
   520   $ hg unbundle initbundle
   521   adding changesets
   521   adding changesets
   528 
   528 
   529 Can skip the head checking steps
   529 Can skip the head checking steps
   530 
   530 
   531   $ 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
   532   checking for the censored content in the working directory
   533   censoring 1 file revision
   533   censoring 1 file revisions
       
   534 
       
   535 Can censor multiple revision in one go.
       
   536 
       
   537   $ cd ../r
       
   538   $ hg --config extensions.censor= censor -r 0+1  target
       
   539   checking for the censored content in 3 heads
       
   540   checking for the censored content in the working directory
       
   541   censoring 2 file revisions
       
   542 
       
   543 
   534 
   544 
   535 #if revlogv2
   545 #if revlogv2
   536 
   546 
   537 Testing feature that does not work in revlog v1
   547 Testing feature that does not work in revlog v1
   538 ===============================================
   548 ===============================================
   570   $ hg cat -r $B1 target | wc -l
   580   $ hg cat -r $B1 target | wc -l
   571    *50002 (re)
   581    *50002 (re)
   572   $ hg --config extensions.censor= censor -r $B1 target
   582   $ hg --config extensions.censor= censor -r $B1 target
   573   checking for the censored content in 1 heads
   583   checking for the censored content in 1 heads
   574   checking for the censored content in the working directory
   584   checking for the censored content in the working directory
   575   censoring 1 file revision
   585   censoring 1 file revisions
   576   $ hg cat -r $B1 target | wc -l
   586   $ hg cat -r $B1 target | wc -l
   577    *0 (re)
   587    *0 (re)
   578 
   588 
   579 Check the children is fine
   589 Check the children is fine
   580 
   590