Show More
@@ -129,6 +129,8 b" def _docensor(ui, repo, path, rev=b'', t" | |||||
129 | hint=_(b'clean/delete and commit first'), |
|
129 | hint=_(b'clean/delete and commit first'), | |
130 | ) |
|
130 | ) | |
131 |
|
131 | |||
|
132 | msg = b'checking for the censored content in the working directory\n' | |||
|
133 | ui.status(msg) | |||
132 | wp = wctx.parents() |
|
134 | wp = wctx.parents() | |
133 | if ctx.node() in [p.node() for p in wp]: |
|
135 | if ctx.node() in [p.node() for p in wp]: | |
134 | raise error.Abort( |
|
136 | raise error.Abort( | |
@@ -136,5 +138,7 b" def _docensor(ui, repo, path, rev=b'', t" | |||||
136 | hint=_(b'clean/delete/update first'), |
|
138 | hint=_(b'clean/delete/update first'), | |
137 | ) |
|
139 | ) | |
138 |
|
140 | |||
|
141 | msg = b'censoring 1 file revision\n' | |||
|
142 | ui.status(msg) | |||
139 | with repo.transaction(b'censor') as tr: |
|
143 | with repo.transaction(b'censor') as tr: | |
140 | flog.censorrevision(tr, fnode, tombstone=tombstone) |
|
144 | flog.censorrevision(tr, fnode, tombstone=tombstone) |
@@ -79,6 +79,8 b' Censor revision with 2 offenses' | |||||
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 | |
@@ -98,6 +100,8 b' Censor revision with 1 offense' | |||||
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 | |
@@ -238,6 +242,8 b" with the file censored, but we can't cen" | |||||
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 | |
@@ -272,6 +278,7 b' Cannot censor working directory' | |||||
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] | |
@@ -286,6 +293,8 b' Can re-add file after being deleted + ce' | |||||
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 | |
@@ -319,6 +328,8 b' Can censor enough revision to move back ' | |||||
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. | |
@@ -398,6 +409,8 b' Censored nodes can be pushed if they cen' | |||||
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 | |
@@ -499,6 +512,8 b' Can import bundle where first revision o' | |||||
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 | |
@@ -514,6 +529,8 b' Can import bundle where first revision o' | |||||
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 | |||
@@ -554,6 +571,8 b' Censor the file' | |||||
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 |
@@ -16,6 +16,8 b'' | |||||
16 | $ hg commit -m "erased secret" |
|
16 | $ hg commit -m "erased secret" | |
17 | $ hg censor target --config extensions.censor= -r ".^^" |
|
17 | $ hg censor target --config extensions.censor= -r ".^^" | |
18 | checking for the censored content in 1 heads |
|
18 | checking for the censored content in 1 heads | |
|
19 | checking for the censored content in the working directory | |||
|
20 | censoring 1 file revision | |||
19 | $ hg update ".^" |
|
21 | $ hg update ".^" | |
20 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
22 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
21 | $ cat target |
|
23 | $ cat target |
General Comments 0
You need to be logged in to leave comments.
Login now