Show More
@@ -127,26 +127,35 b' def v1_censor(rl, tr, censornode, tombst' | |||||
127 |
|
127 | |||
128 | def v2_censor(revlog, 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 | assert revlog._format_version != REVLOGV0, revlog._format_version | |
131 | # |
|
131 | assert revlog._format_version != REVLOGV1, revlog._format_version | |
132 | # We create new revlog files (index/data/sidedata) to copy the content of |
|
132 | ||
133 | # the existing data without the censored data. |
|
133 | censor_revs = {revlog.rev(censornode)} | |
134 | # |
|
134 | _rewrite_v2(revlog, tr, censor_revs, tombstone) | |
135 | # We need to recompute new delta for any revision that used the censored |
|
135 | ||
136 | # revision as delta base. As the cumulative size of the new delta may be |
|
136 | ||
137 | # large, we store them in a temporary file until they are stored in their |
|
137 | def _rewrite_v2(revlog, tr, censor_revs, tombstone=b''): | |
138 | # final destination. |
|
138 | """rewrite a revlog to censor some of its content | |
139 | # |
|
139 | ||
140 | # All data before the censored data can be blindly copied. The rest needs |
|
140 | General principle | |
141 | # to be copied as we go and the associated index entry needs adjustement. |
|
|||
142 |
|
|
141 | ||
|
142 | We create new revlog files (index/data/sidedata) to copy the content of | |||
|
143 | the existing data without the censored data. | |||
|
144 | ||||
|
145 | We need to recompute new delta for any revision that used the censored | |||
|
146 | revision as delta base. As the cumulative size of the new delta may be | |||
|
147 | large, we store them in a temporary file until they are stored in their | |||
|
148 | final destination. | |||
|
149 | ||||
|
150 | All data before the censored data can be blindly copied. The rest needs | |||
|
151 | to be copied as we go and the associated index entry needs adjustement. | |||
|
152 | """ | |||
143 | assert revlog._format_version != REVLOGV0, revlog._format_version |
|
153 | assert revlog._format_version != REVLOGV0, revlog._format_version | |
144 | assert revlog._format_version != REVLOGV1, revlog._format_version |
|
154 | assert revlog._format_version != REVLOGV1, revlog._format_version | |
145 |
|
155 | |||
146 | old_index = revlog.index |
|
156 | old_index = revlog.index | |
147 | docket = revlog._docket |
|
157 | docket = revlog._docket | |
148 |
|
158 | |||
149 | censor_revs = {revlog.rev(censornode)} |
|
|||
150 | tombstone = storageutil.packmeta({b'censored': tombstone}, b'') |
|
159 | tombstone = storageutil.packmeta({b'censored': tombstone}, b'') | |
151 |
|
160 | |||
152 | first_excl_rev = min(censor_revs) |
|
161 | first_excl_rev = min(censor_revs) |
General Comments 0
You need to be logged in to leave comments.
Login now