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