Show More
@@ -125,7 +125,7 b' def v1_censor(rl, tr, censornode, tombst' | |||||
125 | rl._loadindex() |
|
125 | rl._loadindex() | |
126 |
|
126 | |||
127 |
|
127 | |||
128 | def v2_censor(rl, tr, censornode, tombstone=b''): |
|
128 | def v2_censor(revlog, tr, censornode, tombstone=b''): | |
129 | """censors a revision in a "version 2" revlog""" |
|
129 | """censors a revision in a "version 2" revlog""" | |
130 | # General principle |
|
130 | # General principle | |
131 | # |
|
131 | # | |
@@ -140,31 +140,31 b' def v2_censor(rl, tr, censornode, tombst' | |||||
140 | # All data before the censored data can be blindly copied. The rest needs |
|
140 | # All data before the censored data can be blindly copied. The rest needs | |
141 | # to be copied as we go and the associated index entry needs adjustement. |
|
141 | # to be copied as we go and the associated index entry needs adjustement. | |
142 |
|
142 | |||
143 | assert rl._format_version != REVLOGV0, rl._format_version |
|
143 | assert revlog._format_version != REVLOGV0, revlog._format_version | |
144 | assert rl._format_version != REVLOGV1, rl._format_version |
|
144 | assert revlog._format_version != REVLOGV1, revlog._format_version | |
145 |
|
145 | |||
146 | old_index = rl.index |
|
146 | old_index = revlog.index | |
147 | docket = rl._docket |
|
147 | docket = revlog._docket | |
148 |
|
148 | |||
149 | censor_rev = rl.rev(censornode) |
|
149 | censor_rev = revlog.rev(censornode) | |
150 | tombstone = storageutil.packmeta({b'censored': tombstone}, b'') |
|
150 | tombstone = storageutil.packmeta({b'censored': tombstone}, b'') | |
151 |
|
151 | |||
152 | censored_entry = rl.index[censor_rev] |
|
152 | censored_entry = revlog.index[censor_rev] | |
153 | index_cutoff = rl.index.entry_size * censor_rev |
|
153 | index_cutoff = revlog.index.entry_size * censor_rev | |
154 | data_cutoff = censored_entry[ENTRY_DATA_OFFSET] >> 16 |
|
154 | data_cutoff = censored_entry[ENTRY_DATA_OFFSET] >> 16 | |
155 | sidedata_cutoff = rl.sidedata_cut_off(censor_rev) |
|
155 | sidedata_cutoff = revlog.sidedata_cut_off(censor_rev) | |
156 |
|
156 | |||
157 | with pycompat.unnamedtempfile(mode=b"w+b") as tmp_storage: |
|
157 | with pycompat.unnamedtempfile(mode=b"w+b") as tmp_storage: | |
158 | # rev → (new_base, data_start, data_end, compression_mode) |
|
158 | # rev → (new_base, data_start, data_end, compression_mode) | |
159 | rewritten_entries = _precompute_rewritten_delta( |
|
159 | rewritten_entries = _precompute_rewritten_delta( | |
160 | rl, |
|
160 | revlog, | |
161 | old_index, |
|
161 | old_index, | |
162 | {censor_rev}, |
|
162 | {censor_rev}, | |
163 | tmp_storage, |
|
163 | tmp_storage, | |
164 | ) |
|
164 | ) | |
165 |
|
165 | |||
166 | all_files = _setup_new_files( |
|
166 | all_files = _setup_new_files( | |
167 | rl, |
|
167 | revlog, | |
168 | index_cutoff, |
|
168 | index_cutoff, | |
169 | data_cutoff, |
|
169 | data_cutoff, | |
170 | sidedata_cutoff, |
|
170 | sidedata_cutoff, | |
@@ -183,7 +183,7 b' def v2_censor(rl, tr, censornode, tombst' | |||||
183 |
|
183 | |||
184 | # writing the censored revision |
|
184 | # writing the censored revision | |
185 | _rewrite_censor( |
|
185 | _rewrite_censor( | |
186 | rl, |
|
186 | revlog, | |
187 | old_index, |
|
187 | old_index, | |
188 | open_files, |
|
188 | open_files, | |
189 | censor_rev, |
|
189 | censor_rev, | |
@@ -193,7 +193,7 b' def v2_censor(rl, tr, censornode, tombst' | |||||
193 | # Writing all subsequent revisions |
|
193 | # Writing all subsequent revisions | |
194 | for rev in range(censor_rev + 1, len(old_index)): |
|
194 | for rev in range(censor_rev + 1, len(old_index)): | |
195 | _rewrite_simple( |
|
195 | _rewrite_simple( | |
196 | rl, |
|
196 | revlog, | |
197 | old_index, |
|
197 | old_index, | |
198 | open_files, |
|
198 | open_files, | |
199 | rev, |
|
199 | rev, |
General Comments 0
You need to be logged in to leave comments.
Login now