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