Show More
@@ -1,519 +1,513 b'' | |||||
1 | #require no-reposimplestore |
|
1 | #require no-reposimplestore | |
2 |
|
2 | |||
3 | $ cat >> $HGRCPATH <<EOF |
|
3 | $ cat >> $HGRCPATH <<EOF | |
4 | > [extensions] |
|
4 | > [extensions] | |
5 | > censor= |
|
5 | > censor= | |
6 | > EOF |
|
6 | > EOF | |
7 | $ cp $HGRCPATH $HGRCPATH.orig |
|
7 | $ cp $HGRCPATH $HGRCPATH.orig | |
8 |
|
8 | |||
9 | Create repo with unimpeachable content |
|
9 | Create repo with unimpeachable content | |
10 |
|
10 | |||
11 | $ hg init r |
|
11 | $ hg init r | |
12 | $ cd r |
|
12 | $ cd r | |
13 | $ echo 'Initially untainted file' > target |
|
13 | $ echo 'Initially untainted file' > target | |
14 | $ echo 'Normal file here' > bystander |
|
14 | $ echo 'Normal file here' > bystander | |
15 | $ hg add target bystander |
|
15 | $ hg add target bystander | |
16 | $ hg ci -m init |
|
16 | $ hg ci -m init | |
17 |
|
17 | |||
18 | Clone repo so we can test pull later |
|
18 | Clone repo so we can test pull later | |
19 |
|
19 | |||
20 | $ cd .. |
|
20 | $ cd .. | |
21 | $ hg clone r rpull |
|
21 | $ hg clone r rpull | |
22 | updating to branch default |
|
22 | updating to branch default | |
23 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
23 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
24 | $ cd r |
|
24 | $ cd r | |
25 |
|
25 | |||
26 | Introduce content which will ultimately require censorship. Name the first |
|
26 | Introduce content which will ultimately require censorship. Name the first | |
27 | censored node C1, second C2, and so on |
|
27 | censored node C1, second C2, and so on | |
28 |
|
28 | |||
29 | $ echo 'Tainted file' > target |
|
29 | $ echo 'Tainted file' > target | |
30 | $ echo 'Passwords: hunter2' >> target |
|
30 | $ echo 'Passwords: hunter2' >> target | |
31 | $ hg ci -m taint target |
|
31 | $ hg ci -m taint target | |
32 | $ C1=`hg id --debug -i` |
|
32 | $ C1=`hg id --debug -i` | |
33 |
|
33 | |||
34 | $ echo 'hunter3' >> target |
|
34 | $ echo 'hunter3' >> target | |
35 | $ echo 'Normal file v2' > bystander |
|
35 | $ echo 'Normal file v2' > bystander | |
36 | $ hg ci -m moretaint target bystander |
|
36 | $ hg ci -m moretaint target bystander | |
37 | $ C2=`hg id --debug -i` |
|
37 | $ C2=`hg id --debug -i` | |
38 |
|
38 | |||
39 | Add a new sanitized versions to correct our mistake. Name the first head H1, |
|
39 | Add a new sanitized versions to correct our mistake. Name the first head H1, | |
40 | the second head H2, and so on |
|
40 | the second head H2, and so on | |
41 |
|
41 | |||
42 | $ echo 'Tainted file is now sanitized' > target |
|
42 | $ echo 'Tainted file is now sanitized' > target | |
43 | $ hg ci -m sanitized target |
|
43 | $ hg ci -m sanitized target | |
44 | $ H1=`hg id --debug -i` |
|
44 | $ H1=`hg id --debug -i` | |
45 |
|
45 | |||
46 | $ hg update -r $C2 |
|
46 | $ hg update -r $C2 | |
47 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
47 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
48 | $ echo 'Tainted file now super sanitized' > target |
|
48 | $ echo 'Tainted file now super sanitized' > target | |
49 | $ hg ci -m 'super sanitized' target |
|
49 | $ hg ci -m 'super sanitized' target | |
50 | created new head |
|
50 | created new head | |
51 | $ H2=`hg id --debug -i` |
|
51 | $ H2=`hg id --debug -i` | |
52 |
|
52 | |||
53 | Verify target contents before censorship at each revision |
|
53 | Verify target contents before censorship at each revision | |
54 |
|
54 | |||
55 | $ hg cat -r $H1 target |
|
55 | $ hg cat -r $H1 target | head -n 10 | |
56 | Tainted file is now sanitized |
|
56 | Tainted file is now sanitized | |
57 | $ hg cat -r $H2 target |
|
57 | $ hg cat -r $H2 target | head -n 10 | |
58 | Tainted file now super sanitized |
|
58 | Tainted file now super sanitized | |
59 | $ hg cat -r $C2 target |
|
59 | $ hg cat -r $C2 target | head -n 10 | |
60 | Tainted file |
|
60 | Tainted file | |
61 | Passwords: hunter2 |
|
61 | Passwords: hunter2 | |
62 | hunter3 |
|
62 | hunter3 | |
63 | $ hg cat -r $C1 target |
|
63 | $ hg cat -r $C1 target | head -n 10 | |
64 | Tainted file |
|
64 | Tainted file | |
65 | Passwords: hunter2 |
|
65 | Passwords: hunter2 | |
66 | $ hg cat -r 0 target |
|
66 | $ hg cat -r 0 target | head -n 10 | |
67 | Initially untainted file |
|
67 | Initially untainted file | |
68 |
|
68 | |||
69 | Try to censor revision with too large of a tombstone message |
|
69 | Try to censor revision with too large of a tombstone message | |
70 |
|
70 | |||
71 | $ hg censor -r $C1 -t 'blah blah blah blah blah blah blah blah bla' target |
|
71 | $ hg censor -r $C1 -t 'blah blah blah blah blah blah blah blah bla' target | |
72 | abort: censor tombstone must be no longer than censored data |
|
72 | abort: censor tombstone must be no longer than censored data | |
73 | [255] |
|
73 | [255] | |
74 |
|
74 | |||
75 | Censor revision with 2 offenses |
|
75 | Censor revision with 2 offenses | |
76 |
|
76 | |||
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 --cwd foo/bar/baz censor -r $C2 -t "remove password" ../../../target |
|
80 | $ hg --cwd foo/bar/baz censor -r $C2 -t "remove password" ../../../target | |
81 | $ hg cat -r $H1 target |
|
81 | $ hg cat -r $H1 target | head -n 10 | |
82 | Tainted file is now sanitized |
|
82 | Tainted file is now sanitized | |
83 | $ hg cat -r $H2 target |
|
83 | $ hg cat -r $H2 target | head -n 10 | |
84 | Tainted file now super sanitized |
|
84 | Tainted file now super sanitized | |
85 | $ hg cat -r $C2 target |
|
85 | $ hg cat -r $C2 target | head -n 10 | |
86 | abort: censored node: 1e0247a9a4b7 |
|
86 | abort: censored node: 1e0247a9a4b7 | |
87 | (set censor.policy to ignore errors) |
|
87 | (set censor.policy to ignore errors) | |
88 | [255] |
|
88 | $ hg cat -r $C1 target | head -n 10 | |
89 | $ hg cat -r $C1 target |
|
|||
90 | Tainted file |
|
89 | Tainted file | |
91 | Passwords: hunter2 |
|
90 | Passwords: hunter2 | |
92 | $ hg cat -r 0 target |
|
91 | $ hg cat -r 0 target | head -n 10 | |
93 | Initially untainted file |
|
92 | Initially untainted file | |
94 |
|
93 | |||
95 | Censor revision with 1 offense |
|
94 | Censor revision with 1 offense | |
96 |
|
95 | |||
97 | (this also tests file pattern matching: with 'path:' scheme) |
|
96 | (this also tests file pattern matching: with 'path:' scheme) | |
98 |
|
97 | |||
99 | $ hg --cwd foo/bar/baz censor -r $C1 path:target |
|
98 | $ hg --cwd foo/bar/baz censor -r $C1 path:target | |
100 | $ hg cat -r $H1 target |
|
99 | $ hg cat -r $H1 target | head -n 10 | |
101 | Tainted file is now sanitized |
|
100 | Tainted file is now sanitized | |
102 | $ hg cat -r $H2 target |
|
101 | $ hg cat -r $H2 target | head -n 10 | |
103 | Tainted file now super sanitized |
|
102 | Tainted file now super sanitized | |
104 | $ hg cat -r $C2 target |
|
103 | $ hg cat -r $C2 target | head -n 10 | |
105 | abort: censored node: 1e0247a9a4b7 |
|
104 | abort: censored node: 1e0247a9a4b7 | |
106 | (set censor.policy to ignore errors) |
|
105 | (set censor.policy to ignore errors) | |
107 | [255] |
|
106 | $ hg cat -r $C1 target | head -n 10 | |
108 | $ hg cat -r $C1 target |
|
|||
109 | abort: censored node: 613bc869fceb |
|
107 | abort: censored node: 613bc869fceb | |
110 | (set censor.policy to ignore errors) |
|
108 | (set censor.policy to ignore errors) | |
111 | [255] |
|
109 | $ hg cat -r 0 target | head -n 10 | |
112 | $ hg cat -r 0 target |
|
|||
113 | Initially untainted file |
|
110 | Initially untainted file | |
114 |
|
111 | |||
115 | Can only checkout target at uncensored revisions, -X is workaround for --all |
|
112 | Can only checkout target at uncensored revisions, -X is workaround for --all | |
116 |
|
113 | |||
117 | $ hg revert -r $C2 target |
|
114 | $ hg revert -r $C2 target | head -n 10 | |
118 | abort: censored node: 1e0247a9a4b7 |
|
115 | abort: censored node: 1e0247a9a4b7 | |
119 | (set censor.policy to ignore errors) |
|
116 | (set censor.policy to ignore errors) | |
120 | [255] |
|
117 | $ hg revert -r $C1 target | head -n 10 | |
121 | $ hg revert -r $C1 target |
|
|||
122 | abort: censored node: 613bc869fceb |
|
118 | abort: censored node: 613bc869fceb | |
123 | (set censor.policy to ignore errors) |
|
119 | (set censor.policy to ignore errors) | |
124 | [255] |
|
|||
125 | $ hg revert -r $C1 --all |
|
120 | $ hg revert -r $C1 --all | |
126 | reverting bystander |
|
121 | reverting bystander | |
127 | reverting target |
|
122 | reverting target | |
128 | abort: censored node: 613bc869fceb |
|
123 | abort: censored node: 613bc869fceb | |
129 | (set censor.policy to ignore errors) |
|
124 | (set censor.policy to ignore errors) | |
130 | [255] |
|
125 | [255] | |
131 | $ hg revert -r $C1 --all -X target |
|
126 | $ hg revert -r $C1 --all -X target | |
132 | $ cat target |
|
127 | $ cat target | head -n 10 | |
133 | Tainted file now super sanitized |
|
128 | Tainted file now super sanitized | |
134 | $ hg revert -r 0 --all |
|
129 | $ hg revert -r 0 --all | |
135 | reverting target |
|
130 | reverting target | |
136 | $ cat target |
|
131 | $ cat target | head -n 10 | |
137 | Initially untainted file |
|
132 | Initially untainted file | |
138 | $ hg revert -r $H2 --all |
|
133 | $ hg revert -r $H2 --all | |
139 | reverting bystander |
|
134 | reverting bystander | |
140 | reverting target |
|
135 | reverting target | |
141 | $ cat target |
|
136 | $ cat target | head -n 10 | |
142 | Tainted file now super sanitized |
|
137 | Tainted file now super sanitized | |
143 |
|
138 | |||
144 | Uncensored file can be viewed at any revision |
|
139 | Uncensored file can be viewed at any revision | |
145 |
|
140 | |||
146 | $ hg cat -r $H1 bystander |
|
141 | $ hg cat -r $H1 bystander | head -n 10 | |
147 | Normal file v2 |
|
142 | Normal file v2 | |
148 | $ hg cat -r $C2 bystander |
|
143 | $ hg cat -r $C2 bystander | head -n 10 | |
149 | Normal file v2 |
|
144 | Normal file v2 | |
150 | $ hg cat -r $C1 bystander |
|
145 | $ hg cat -r $C1 bystander | head -n 10 | |
151 | Normal file here |
|
146 | Normal file here | |
152 | $ hg cat -r 0 bystander |
|
147 | $ hg cat -r 0 bystander | head -n 10 | |
153 | Normal file here |
|
148 | Normal file here | |
154 |
|
149 | |||
155 | Can update to children of censored revision |
|
150 | Can update to children of censored revision | |
156 |
|
151 | |||
157 | $ hg update -r $H1 |
|
152 | $ hg update -r $H1 | |
158 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
153 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
159 | $ cat target |
|
154 | $ cat target | head -n 10 | |
160 | Tainted file is now sanitized |
|
155 | Tainted file is now sanitized | |
161 | $ hg update -r $H2 |
|
156 | $ hg update -r $H2 | |
162 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
157 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
163 | $ cat target |
|
158 | $ cat target | head -n 10 | |
164 | Tainted file now super sanitized |
|
159 | Tainted file now super sanitized | |
165 |
|
160 | |||
166 | Set censor policy to abort in trusted $HGRC so hg verify fails |
|
161 | Set censor policy to abort in trusted $HGRC so hg verify fails | |
167 |
|
162 | |||
168 | $ cp $HGRCPATH.orig $HGRCPATH |
|
163 | $ cp $HGRCPATH.orig $HGRCPATH | |
169 | $ cat >> $HGRCPATH <<EOF |
|
164 | $ cat >> $HGRCPATH <<EOF | |
170 | > [censor] |
|
165 | > [censor] | |
171 | > policy = abort |
|
166 | > policy = abort | |
172 | > EOF |
|
167 | > EOF | |
173 |
|
168 | |||
174 | Repo fails verification due to censorship |
|
169 | Repo fails verification due to censorship | |
175 |
|
170 | |||
176 | $ hg verify |
|
171 | $ hg verify | |
177 | checking changesets |
|
172 | checking changesets | |
178 | checking manifests |
|
173 | checking manifests | |
179 | crosschecking files in changesets and manifests |
|
174 | crosschecking files in changesets and manifests | |
180 | checking files |
|
175 | checking files | |
181 | target@1: censored file data |
|
176 | target@1: censored file data | |
182 | target@2: censored file data |
|
177 | target@2: censored file data | |
183 | checked 5 changesets with 7 changes to 2 files |
|
178 | checked 5 changesets with 7 changes to 2 files | |
184 | 2 integrity errors encountered! |
|
179 | 2 integrity errors encountered! | |
185 | (first damaged changeset appears to be 1) |
|
180 | (first damaged changeset appears to be 1) | |
186 | [1] |
|
181 | [1] | |
187 |
|
182 | |||
188 | Cannot update to revision with censored data |
|
183 | Cannot update to revision with censored data | |
189 |
|
184 | |||
190 | $ hg update -r $C2 |
|
185 | $ hg update -r $C2 | |
191 | abort: censored node: 1e0247a9a4b7 |
|
186 | abort: censored node: 1e0247a9a4b7 | |
192 | (set censor.policy to ignore errors) |
|
187 | (set censor.policy to ignore errors) | |
193 | [255] |
|
188 | [255] | |
194 | $ hg update -r $C1 |
|
189 | $ hg update -r $C1 | |
195 | abort: censored node: 613bc869fceb |
|
190 | abort: censored node: 613bc869fceb | |
196 | (set censor.policy to ignore errors) |
|
191 | (set censor.policy to ignore errors) | |
197 | [255] |
|
192 | [255] | |
198 | $ hg update -r 0 |
|
193 | $ hg update -r 0 | |
199 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
194 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
200 | $ hg update -r $H2 |
|
195 | $ hg update -r $H2 | |
201 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
196 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
202 |
|
197 | |||
203 | Set censor policy to ignore in trusted $HGRC so hg verify passes |
|
198 | Set censor policy to ignore in trusted $HGRC so hg verify passes | |
204 |
|
199 | |||
205 | $ cp $HGRCPATH.orig $HGRCPATH |
|
200 | $ cp $HGRCPATH.orig $HGRCPATH | |
206 | $ cat >> $HGRCPATH <<EOF |
|
201 | $ cat >> $HGRCPATH <<EOF | |
207 | > [censor] |
|
202 | > [censor] | |
208 | > policy = ignore |
|
203 | > policy = ignore | |
209 | > EOF |
|
204 | > EOF | |
210 |
|
205 | |||
211 | Repo passes verification with warnings with explicit config |
|
206 | Repo passes verification with warnings with explicit config | |
212 |
|
207 | |||
213 | $ hg verify |
|
208 | $ hg verify | |
214 | checking changesets |
|
209 | checking changesets | |
215 | checking manifests |
|
210 | checking manifests | |
216 | crosschecking files in changesets and manifests |
|
211 | crosschecking files in changesets and manifests | |
217 | checking files |
|
212 | checking files | |
218 | checked 5 changesets with 7 changes to 2 files |
|
213 | checked 5 changesets with 7 changes to 2 files | |
219 |
|
214 | |||
220 | May update to revision with censored data with explicit config |
|
215 | May update to revision with censored data with explicit config | |
221 |
|
216 | |||
222 | $ hg update -r $C2 |
|
217 | $ hg update -r $C2 | |
223 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
218 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
224 | $ cat target |
|
219 | $ cat target | head -n 10 | |
225 | $ hg update -r $C1 |
|
220 | $ hg update -r $C1 | |
226 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
221 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
227 | $ cat target |
|
222 | $ cat target | head -n 10 | |
228 | $ hg update -r 0 |
|
223 | $ hg update -r 0 | |
229 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
224 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
230 | $ cat target |
|
225 | $ cat target | head -n 10 | |
231 | Initially untainted file |
|
226 | Initially untainted file | |
232 | $ hg update -r $H2 |
|
227 | $ hg update -r $H2 | |
233 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
228 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
234 | $ cat target |
|
229 | $ cat target | head -n 10 | |
235 | Tainted file now super sanitized |
|
230 | Tainted file now super sanitized | |
236 |
|
231 | |||
237 | Can merge in revision with censored data. Test requires one branch of history |
|
232 | Can merge in revision with censored data. Test requires one branch of history | |
238 | with the file censored, but we can't censor at a head, so advance H1. |
|
233 | with the file censored, but we can't censor at a head, so advance H1. | |
239 |
|
234 | |||
240 | $ hg update -r $H1 |
|
235 | $ hg update -r $H1 | |
241 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
236 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
242 | $ C3=$H1 |
|
237 | $ C3=$H1 | |
243 | $ echo 'advanced head H1' > target |
|
238 | $ echo 'advanced head H1' > target | |
244 | $ hg ci -m 'advance head H1' target |
|
239 | $ hg ci -m 'advance head H1' target | |
245 | $ H1=`hg id --debug -i` |
|
240 | $ H1=`hg id --debug -i` | |
246 | $ hg censor -r $C3 target |
|
241 | $ hg censor -r $C3 target | |
247 | $ hg update -r $H2 |
|
242 | $ hg update -r $H2 | |
248 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
243 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
249 | $ hg merge -r $C3 |
|
244 | $ hg merge -r $C3 | |
250 | merging target |
|
245 | merging target | |
251 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
246 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved | |
252 | (branch merge, don't forget to commit) |
|
247 | (branch merge, don't forget to commit) | |
253 |
|
248 | |||
254 | Revisions present in repository heads may not be censored |
|
249 | Revisions present in repository heads may not be censored | |
255 |
|
250 | |||
256 | $ hg update -C -r $H2 |
|
251 | $ hg update -C -r $H2 | |
257 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
252 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
258 | $ hg censor -r $H2 target |
|
253 | $ hg censor -r $H2 target | |
259 | abort: cannot censor file in heads (78a8fc215e79) |
|
254 | abort: cannot censor file in heads (78a8fc215e79) | |
260 | (clean/delete and commit first) |
|
255 | (clean/delete and commit first) | |
261 | [255] |
|
256 | [255] | |
262 | $ echo 'twiddling thumbs' > bystander |
|
257 | $ echo 'twiddling thumbs' > bystander | |
263 | $ hg ci -m 'bystander commit' |
|
258 | $ hg ci -m 'bystander commit' | |
264 | $ H2=`hg id --debug -i` |
|
259 | $ H2=`hg id --debug -i` | |
265 | $ hg censor -r "$H2^" target |
|
260 | $ hg censor -r "$H2^" target | |
266 | abort: cannot censor file in heads (efbe78065929) |
|
261 | abort: cannot censor file in heads (efbe78065929) | |
267 | (clean/delete and commit first) |
|
262 | (clean/delete and commit first) | |
268 | [255] |
|
263 | [255] | |
269 |
|
264 | |||
270 | Cannot censor working directory |
|
265 | Cannot censor working directory | |
271 |
|
266 | |||
272 | $ echo 'seriously no passwords' > target |
|
267 | $ echo 'seriously no passwords' > target | |
273 | $ hg ci -m 'extend second head arbitrarily' target |
|
268 | $ hg ci -m 'extend second head arbitrarily' target | |
274 | $ H2=`hg id --debug -i` |
|
269 | $ H2=`hg id --debug -i` | |
275 | $ hg update -r "$H2^" |
|
270 | $ hg update -r "$H2^" | |
276 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
271 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
277 | $ hg censor -r . target |
|
272 | $ hg censor -r . target | |
278 | abort: cannot censor working directory |
|
273 | abort: cannot censor working directory | |
279 | (clean/delete/update first) |
|
274 | (clean/delete/update first) | |
280 | [255] |
|
275 | [255] | |
281 | $ hg update -r $H2 |
|
276 | $ hg update -r $H2 | |
282 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
277 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
283 |
|
278 | |||
284 | Can re-add file after being deleted + censored |
|
279 | Can re-add file after being deleted + censored | |
285 |
|
280 | |||
286 | $ C4=$H2 |
|
281 | $ C4=$H2 | |
287 | $ hg rm target |
|
282 | $ hg rm target | |
288 | $ hg ci -m 'delete target so it may be censored' |
|
283 | $ hg ci -m 'delete target so it may be censored' | |
289 | $ H2=`hg id --debug -i` |
|
284 | $ H2=`hg id --debug -i` | |
290 | $ hg censor -r $C4 target |
|
285 | $ hg censor -r $C4 target | |
291 | $ hg cat -r $C4 target |
|
286 | $ hg cat -r $C4 target | head -n 10 | |
292 | $ hg cat -r "$H2^^" target |
|
287 | $ hg cat -r "$H2^^" target | head -n 10 | |
293 | Tainted file now super sanitized |
|
288 | Tainted file now super sanitized | |
294 | $ echo 'fresh start' > target |
|
289 | $ echo 'fresh start' > target | |
295 | $ hg add target |
|
290 | $ hg add target | |
296 | $ hg ci -m reincarnated target |
|
291 | $ hg ci -m reincarnated target | |
297 | $ H2=`hg id --debug -i` |
|
292 | $ H2=`hg id --debug -i` | |
298 | $ hg cat -r $H2 target |
|
293 | $ hg cat -r $H2 target | head -n 10 | |
299 | fresh start |
|
294 | fresh start | |
300 | $ hg cat -r "$H2^" target |
|
295 | $ hg cat -r "$H2^" target | head -n 10 | |
301 | target: no such file in rev 452ec1762369 |
|
296 | target: no such file in rev 452ec1762369 | |
302 | [1] |
|
297 | $ hg cat -r $C4 target | head -n 10 | |
303 |
$ hg cat -r |
|
298 | $ hg cat -r "$H2^^^" target | head -n 10 | |
304 | $ hg cat -r "$H2^^^" target |
|
|||
305 | Tainted file now super sanitized |
|
299 | Tainted file now super sanitized | |
306 |
|
300 | |||
307 | Can censor after revlog has expanded to no longer permit inline storage |
|
301 | Can censor after revlog has expanded to no longer permit inline storage | |
308 |
|
302 | |||
309 | $ for x in `"$PYTHON" $TESTDIR/seq.py 0 50000` |
|
303 | $ for x in `"$PYTHON" $TESTDIR/seq.py 0 50000` | |
310 | > do |
|
304 | > do | |
311 | > echo "Password: hunter$x" >> target |
|
305 | > echo "Password: hunter$x" >> target | |
312 | > done |
|
306 | > done | |
313 | $ hg ci -m 'add 100k passwords' |
|
307 | $ hg ci -m 'add 100k passwords' | |
314 | $ H2=`hg id --debug -i` |
|
308 | $ H2=`hg id --debug -i` | |
315 | $ C5=$H2 |
|
309 | $ C5=$H2 | |
316 | $ hg revert -r "$H2^" target |
|
310 | $ hg revert -r "$H2^" target | |
317 | $ hg ci -m 'cleaned 100k passwords' |
|
311 | $ hg ci -m 'cleaned 100k passwords' | |
318 | $ H2=`hg id --debug -i` |
|
312 | $ H2=`hg id --debug -i` | |
319 | $ hg censor -r $C5 target |
|
313 | $ hg censor -r $C5 target | |
320 | $ hg cat -r $C5 target |
|
314 | $ hg cat -r $C5 target | head -n 10 | |
321 | $ hg cat -r $H2 target |
|
315 | $ hg cat -r $H2 target | head -n 10 | |
322 | fresh start |
|
316 | fresh start | |
323 |
|
317 | |||
324 | Repo with censored nodes can be cloned and cloned nodes are censored |
|
318 | Repo with censored nodes can be cloned and cloned nodes are censored | |
325 |
|
319 | |||
326 | $ cd .. |
|
320 | $ cd .. | |
327 | $ hg clone r rclone |
|
321 | $ hg clone r rclone | |
328 | updating to branch default |
|
322 | updating to branch default | |
329 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
323 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
330 | $ cd rclone |
|
324 | $ cd rclone | |
331 | $ hg cat -r $H1 target |
|
325 | $ hg cat -r $H1 target | head -n 10 | |
332 | advanced head H1 |
|
326 | advanced head H1 | |
333 | $ hg cat -r $H2~5 target |
|
327 | $ hg cat -r $H2~5 target | head -n 10 | |
334 | Tainted file now super sanitized |
|
328 | Tainted file now super sanitized | |
335 | $ hg cat -r $C2 target |
|
329 | $ hg cat -r $C2 target | head -n 10 | |
336 | $ hg cat -r $C1 target |
|
330 | $ hg cat -r $C1 target | head -n 10 | |
337 | $ hg cat -r 0 target |
|
331 | $ hg cat -r 0 target | head -n 10 | |
338 | Initially untainted file |
|
332 | Initially untainted file | |
339 | $ hg verify |
|
333 | $ hg verify | |
340 | checking changesets |
|
334 | checking changesets | |
341 | checking manifests |
|
335 | checking manifests | |
342 | crosschecking files in changesets and manifests |
|
336 | crosschecking files in changesets and manifests | |
343 | checking files |
|
337 | checking files | |
344 | checked 12 changesets with 13 changes to 2 files |
|
338 | checked 12 changesets with 13 changes to 2 files | |
345 |
|
339 | |||
346 | Repo cloned before tainted content introduced can pull censored nodes |
|
340 | Repo cloned before tainted content introduced can pull censored nodes | |
347 |
|
341 | |||
348 | $ cd ../rpull |
|
342 | $ cd ../rpull | |
349 | $ hg cat -r tip target |
|
343 | $ hg cat -r tip target | head -n 10 | |
350 | Initially untainted file |
|
344 | Initially untainted file | |
351 | $ hg verify |
|
345 | $ hg verify | |
352 | checking changesets |
|
346 | checking changesets | |
353 | checking manifests |
|
347 | checking manifests | |
354 | crosschecking files in changesets and manifests |
|
348 | crosschecking files in changesets and manifests | |
355 | checking files |
|
349 | checking files | |
356 | checked 1 changesets with 2 changes to 2 files |
|
350 | checked 1 changesets with 2 changes to 2 files | |
357 | $ hg pull -r $H1 -r $H2 |
|
351 | $ hg pull -r $H1 -r $H2 | |
358 | pulling from $TESTTMP/r |
|
352 | pulling from $TESTTMP/r | |
359 | searching for changes |
|
353 | searching for changes | |
360 | adding changesets |
|
354 | adding changesets | |
361 | adding manifests |
|
355 | adding manifests | |
362 | adding file changes |
|
356 | adding file changes | |
363 | added 11 changesets with 11 changes to 2 files (+1 heads) |
|
357 | added 11 changesets with 11 changes to 2 files (+1 heads) | |
364 | new changesets 186fb27560c3:683e4645fded |
|
358 | new changesets 186fb27560c3:683e4645fded | |
365 | (run 'hg heads' to see heads, 'hg merge' to merge) |
|
359 | (run 'hg heads' to see heads, 'hg merge' to merge) | |
366 | $ hg update 4 |
|
360 | $ hg update 4 | |
367 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
361 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
368 | $ cat target |
|
362 | $ cat target | head -n 10 | |
369 | Tainted file now super sanitized |
|
363 | Tainted file now super sanitized | |
370 | $ hg cat -r $H1 target |
|
364 | $ hg cat -r $H1 target | head -n 10 | |
371 | advanced head H1 |
|
365 | advanced head H1 | |
372 | $ hg cat -r $H2~5 target |
|
366 | $ hg cat -r $H2~5 target | head -n 10 | |
373 | Tainted file now super sanitized |
|
367 | Tainted file now super sanitized | |
374 | $ hg cat -r $C2 target |
|
368 | $ hg cat -r $C2 target | head -n 10 | |
375 | $ hg cat -r $C1 target |
|
369 | $ hg cat -r $C1 target | head -n 10 | |
376 | $ hg cat -r 0 target |
|
370 | $ hg cat -r 0 target | head -n 10 | |
377 | Initially untainted file |
|
371 | Initially untainted file | |
378 | $ hg verify |
|
372 | $ hg verify | |
379 | checking changesets |
|
373 | checking changesets | |
380 | checking manifests |
|
374 | checking manifests | |
381 | crosschecking files in changesets and manifests |
|
375 | crosschecking files in changesets and manifests | |
382 | checking files |
|
376 | checking files | |
383 | checked 12 changesets with 13 changes to 2 files |
|
377 | checked 12 changesets with 13 changes to 2 files | |
384 |
|
378 | |||
385 | Censored nodes can be pushed if they censor previously unexchanged nodes |
|
379 | Censored nodes can be pushed if they censor previously unexchanged nodes | |
386 |
|
380 | |||
387 | $ echo 'Passwords: hunter2hunter2' > target |
|
381 | $ echo 'Passwords: hunter2hunter2' > target | |
388 | $ hg ci -m 're-add password from clone' target |
|
382 | $ hg ci -m 're-add password from clone' target | |
389 | created new head |
|
383 | created new head | |
390 | $ H3=`hg id --debug -i` |
|
384 | $ H3=`hg id --debug -i` | |
391 | $ REV=$H3 |
|
385 | $ REV=$H3 | |
392 | $ echo 'Re-sanitized; nothing to see here' > target |
|
386 | $ echo 'Re-sanitized; nothing to see here' > target | |
393 | $ hg ci -m 're-sanitized' target |
|
387 | $ hg ci -m 're-sanitized' target | |
394 | $ H2=`hg id --debug -i` |
|
388 | $ H2=`hg id --debug -i` | |
395 | $ CLEANREV=$H2 |
|
389 | $ CLEANREV=$H2 | |
396 | $ hg cat -r $REV target |
|
390 | $ hg cat -r $REV target | head -n 10 | |
397 | Passwords: hunter2hunter2 |
|
391 | Passwords: hunter2hunter2 | |
398 | $ hg censor -r $REV target |
|
392 | $ hg censor -r $REV target | |
399 | $ hg cat -r $REV target |
|
393 | $ hg cat -r $REV target | head -n 10 | |
400 | $ hg cat -r $CLEANREV target |
|
394 | $ hg cat -r $CLEANREV target | head -n 10 | |
401 | Re-sanitized; nothing to see here |
|
395 | Re-sanitized; nothing to see here | |
402 | $ hg push -f -r $H2 |
|
396 | $ hg push -f -r $H2 | |
403 | pushing to $TESTTMP/r |
|
397 | pushing to $TESTTMP/r | |
404 | searching for changes |
|
398 | searching for changes | |
405 | adding changesets |
|
399 | adding changesets | |
406 | adding manifests |
|
400 | adding manifests | |
407 | adding file changes |
|
401 | adding file changes | |
408 | added 2 changesets with 2 changes to 1 files (+1 heads) |
|
402 | added 2 changesets with 2 changes to 1 files (+1 heads) | |
409 |
|
403 | |||
410 | $ cd ../r |
|
404 | $ cd ../r | |
411 | $ hg cat -r $REV target |
|
405 | $ hg cat -r $REV target | head -n 10 | |
412 | $ hg cat -r $CLEANREV target |
|
406 | $ hg cat -r $CLEANREV target | head -n 10 | |
413 | Re-sanitized; nothing to see here |
|
407 | Re-sanitized; nothing to see here | |
414 | $ hg update $CLEANREV |
|
408 | $ hg update $CLEANREV | |
415 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
409 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
416 | $ cat target |
|
410 | $ cat target | head -n 10 | |
417 | Re-sanitized; nothing to see here |
|
411 | Re-sanitized; nothing to see here | |
418 |
|
412 | |||
419 | Censored nodes can be bundled up and unbundled in another repo |
|
413 | Censored nodes can be bundled up and unbundled in another repo | |
420 |
|
414 | |||
421 | $ hg bundle --base 0 ../pwbundle |
|
415 | $ hg bundle --base 0 ../pwbundle | |
422 | 13 changesets found |
|
416 | 13 changesets found | |
423 | $ cd ../rclone |
|
417 | $ cd ../rclone | |
424 | $ hg unbundle ../pwbundle |
|
418 | $ hg unbundle ../pwbundle | |
425 | adding changesets |
|
419 | adding changesets | |
426 | adding manifests |
|
420 | adding manifests | |
427 | adding file changes |
|
421 | adding file changes | |
428 | added 2 changesets with 2 changes to 2 files (+1 heads) |
|
422 | added 2 changesets with 2 changes to 2 files (+1 heads) | |
429 | new changesets 075be80ac777:dcbaf17bf3a1 (2 drafts) |
|
423 | new changesets 075be80ac777:dcbaf17bf3a1 (2 drafts) | |
430 | (run 'hg heads .' to see heads, 'hg merge' to merge) |
|
424 | (run 'hg heads .' to see heads, 'hg merge' to merge) | |
431 | $ hg cat -r $REV target |
|
425 | $ hg cat -r $REV target | head -n 10 | |
432 | $ hg cat -r $CLEANREV target |
|
426 | $ hg cat -r $CLEANREV target | head -n 10 | |
433 | Re-sanitized; nothing to see here |
|
427 | Re-sanitized; nothing to see here | |
434 | $ hg update $CLEANREV |
|
428 | $ hg update $CLEANREV | |
435 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
429 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
436 | $ cat target |
|
430 | $ cat target | head -n 10 | |
437 | Re-sanitized; nothing to see here |
|
431 | Re-sanitized; nothing to see here | |
438 | $ hg verify |
|
432 | $ hg verify | |
439 | checking changesets |
|
433 | checking changesets | |
440 | checking manifests |
|
434 | checking manifests | |
441 | crosschecking files in changesets and manifests |
|
435 | crosschecking files in changesets and manifests | |
442 | checking files |
|
436 | checking files | |
443 | checked 14 changesets with 15 changes to 2 files |
|
437 | checked 14 changesets with 15 changes to 2 files | |
444 |
|
438 | |||
445 | Grepping only warns, doesn't error out |
|
439 | Grepping only warns, doesn't error out | |
446 |
|
440 | |||
447 | $ cd ../rpull |
|
441 | $ cd ../rpull | |
448 | $ hg grep 'Normal file' |
|
442 | $ hg grep 'Normal file' | |
449 | bystander:Normal file v2 |
|
443 | bystander:Normal file v2 | |
450 | $ hg grep nothing |
|
444 | $ hg grep nothing | |
451 | target:Re-sanitized; nothing to see here |
|
445 | target:Re-sanitized; nothing to see here | |
452 | $ hg grep --diff 'Normal file' |
|
446 | $ hg grep --diff 'Normal file' | |
453 | cannot search in censored file: target:7 |
|
447 | cannot search in censored file: target:7 | |
454 | cannot search in censored file: target:10 |
|
448 | cannot search in censored file: target:10 | |
455 | cannot search in censored file: target:12 |
|
449 | cannot search in censored file: target:12 | |
456 | bystander:6:-:Normal file v2 |
|
450 | bystander:6:-:Normal file v2 | |
457 | cannot search in censored file: target:1 |
|
451 | cannot search in censored file: target:1 | |
458 | cannot search in censored file: target:2 |
|
452 | cannot search in censored file: target:2 | |
459 | cannot search in censored file: target:3 |
|
453 | cannot search in censored file: target:3 | |
460 | bystander:2:-:Normal file here |
|
454 | bystander:2:-:Normal file here | |
461 | bystander:2:+:Normal file v2 |
|
455 | bystander:2:+:Normal file v2 | |
462 | bystander:0:+:Normal file here |
|
456 | bystander:0:+:Normal file here | |
463 | $ hg grep --diff nothing |
|
457 | $ hg grep --diff nothing | |
464 | cannot search in censored file: target:7 |
|
458 | cannot search in censored file: target:7 | |
465 | cannot search in censored file: target:10 |
|
459 | cannot search in censored file: target:10 | |
466 | cannot search in censored file: target:12 |
|
460 | cannot search in censored file: target:12 | |
467 | target:13:+:Re-sanitized; nothing to see here |
|
461 | target:13:+:Re-sanitized; nothing to see here | |
468 | cannot search in censored file: target:1 |
|
462 | cannot search in censored file: target:1 | |
469 | cannot search in censored file: target:2 |
|
463 | cannot search in censored file: target:2 | |
470 | cannot search in censored file: target:3 |
|
464 | cannot search in censored file: target:3 | |
471 |
|
465 | |||
472 | Censored nodes can be imported on top of censored nodes, consecutively |
|
466 | Censored nodes can be imported on top of censored nodes, consecutively | |
473 |
|
467 | |||
474 | $ hg init ../rimport |
|
468 | $ hg init ../rimport | |
475 | $ hg bundle --base 1 ../rimport/splitbundle |
|
469 | $ hg bundle --base 1 ../rimport/splitbundle | |
476 | 12 changesets found |
|
470 | 12 changesets found | |
477 | $ cd ../rimport |
|
471 | $ cd ../rimport | |
478 | $ hg pull -r $H1 -r $H2 ../r |
|
472 | $ hg pull -r $H1 -r $H2 ../r | |
479 | pulling from ../r |
|
473 | pulling from ../r | |
480 | adding changesets |
|
474 | adding changesets | |
481 | adding manifests |
|
475 | adding manifests | |
482 | adding file changes |
|
476 | adding file changes | |
483 | added 8 changesets with 10 changes to 2 files (+1 heads) |
|
477 | added 8 changesets with 10 changes to 2 files (+1 heads) | |
484 | new changesets e97f55b2665a:dcbaf17bf3a1 |
|
478 | new changesets e97f55b2665a:dcbaf17bf3a1 | |
485 | (run 'hg heads' to see heads, 'hg merge' to merge) |
|
479 | (run 'hg heads' to see heads, 'hg merge' to merge) | |
486 | $ hg unbundle splitbundle |
|
480 | $ hg unbundle splitbundle | |
487 | adding changesets |
|
481 | adding changesets | |
488 | adding manifests |
|
482 | adding manifests | |
489 | adding file changes |
|
483 | adding file changes | |
490 | added 6 changesets with 5 changes to 2 files (+1 heads) |
|
484 | added 6 changesets with 5 changes to 2 files (+1 heads) | |
491 | new changesets efbe78065929:683e4645fded (6 drafts) |
|
485 | new changesets efbe78065929:683e4645fded (6 drafts) | |
492 | (run 'hg heads .' to see heads, 'hg merge' to merge) |
|
486 | (run 'hg heads .' to see heads, 'hg merge' to merge) | |
493 | $ hg update $H2 |
|
487 | $ hg update $H2 | |
494 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
488 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
495 | $ cat target |
|
489 | $ cat target | head -n 10 | |
496 | Re-sanitized; nothing to see here |
|
490 | Re-sanitized; nothing to see here | |
497 | $ hg verify |
|
491 | $ hg verify | |
498 | checking changesets |
|
492 | checking changesets | |
499 | checking manifests |
|
493 | checking manifests | |
500 | crosschecking files in changesets and manifests |
|
494 | crosschecking files in changesets and manifests | |
501 | checking files |
|
495 | checking files | |
502 | checked 14 changesets with 15 changes to 2 files |
|
496 | checked 14 changesets with 15 changes to 2 files | |
503 | $ cd ../r |
|
497 | $ cd ../r | |
504 |
|
498 | |||
505 | Can import bundle where first revision of a file is censored |
|
499 | Can import bundle where first revision of a file is censored | |
506 |
|
500 | |||
507 | $ hg init ../rinit |
|
501 | $ hg init ../rinit | |
508 | $ hg censor -r 0 target |
|
502 | $ hg censor -r 0 target | |
509 | $ hg bundle -r 0 --base null ../rinit/initbundle |
|
503 | $ hg bundle -r 0 --base null ../rinit/initbundle | |
510 | 1 changesets found |
|
504 | 1 changesets found | |
511 | $ cd ../rinit |
|
505 | $ cd ../rinit | |
512 | $ hg unbundle initbundle |
|
506 | $ hg unbundle initbundle | |
513 | adding changesets |
|
507 | adding changesets | |
514 | adding manifests |
|
508 | adding manifests | |
515 | adding file changes |
|
509 | adding file changes | |
516 | added 1 changesets with 2 changes to 2 files |
|
510 | added 1 changesets with 2 changes to 2 files | |
517 | new changesets e97f55b2665a (1 drafts) |
|
511 | new changesets e97f55b2665a (1 drafts) | |
518 | (run 'hg update' to get a working copy) |
|
512 | (run 'hg update' to get a working copy) | |
519 | $ hg cat -r 0 target |
|
513 | $ hg cat -r 0 target | head -n 10 |
General Comments 0
You need to be logged in to leave comments.
Login now