Show More
@@ -118,7 +118,7 b' class flagprocessorsmixin(object):' | |||||
118 | processed text and ``validatehash`` is a bool indicating whether the |
|
118 | processed text and ``validatehash`` is a bool indicating whether the | |
119 | returned text should be checked for hash integrity. |
|
119 | returned text should be checked for hash integrity. | |
120 | """ |
|
120 | """ | |
121 |
return |
|
121 | return _processflagsfunc(self, text, flags, 'read') | |
122 |
|
122 | |||
123 | def _processflagswrite(self, text, flags, sidedata): |
|
123 | def _processflagswrite(self, text, flags, sidedata): | |
124 | """Inspect revision data flags and applies write transformations defined |
|
124 | """Inspect revision data flags and applies write transformations defined | |
@@ -136,7 +136,7 b' class flagprocessorsmixin(object):' | |||||
136 | processed text and ``validatehash`` is a bool indicating whether the |
|
136 | processed text and ``validatehash`` is a bool indicating whether the | |
137 | returned text should be checked for hash integrity. |
|
137 | returned text should be checked for hash integrity. | |
138 | """ |
|
138 | """ | |
139 |
return |
|
139 | return _processflagsfunc(self, text, flags, 'write', | |
140 |
|
|
140 | sidedata=sidedata)[:2] | |
141 |
|
141 | |||
142 | def _processflagsraw(self, text, flags): |
|
142 | def _processflagsraw(self, text, flags): | |
@@ -155,9 +155,13 b' class flagprocessorsmixin(object):' | |||||
155 | processed text and ``validatehash`` is a bool indicating whether the |
|
155 | processed text and ``validatehash`` is a bool indicating whether the | |
156 | returned text should be checked for hash integrity. |
|
156 | returned text should be checked for hash integrity. | |
157 | """ |
|
157 | """ | |
158 |
return |
|
158 | return _processflagsfunc(self, text, flags, 'raw')[1] | |
159 |
|
159 | |||
160 |
|
|
160 | def _processflagsfunc(revlog, text, flags, operation, sidedata=None): | |
|
161 | """internal function to process flag on a revlog | |||
|
162 | ||||
|
163 | This function is private to this module, code should never needs to call it | |||
|
164 | directly.""" | |||
161 |
|
|
165 | # fast path: no flag processors will run | |
162 |
|
|
166 | if flags == 0: | |
163 |
|
|
167 | return text, True, {} | |
@@ -166,7 +170,7 b' class flagprocessorsmixin(object):' | |||||
166 |
|
|
170 | operation) | |
167 |
|
|
171 | # Check all flags are known. | |
168 |
|
|
172 | if flags & ~REVIDX_KNOWN_FLAGS: | |
169 |
|
|
173 | raise revlog._flagserrorclass(_("incompatible revision flag '%#x'") % | |
170 |
|
|
174 | (flags & ~REVIDX_KNOWN_FLAGS)) | |
171 |
|
|
175 | validatehash = True | |
172 |
|
|
176 | # Depending on the operation (read or write), the order might be | |
@@ -182,21 +186,21 b' class flagprocessorsmixin(object):' | |||||
182 |
|
|
186 | if flag & flags: | |
183 |
|
|
187 | vhash = True | |
184 |
|
188 | |||
185 |
|
|
189 | if flag not in revlog._flagprocessors: | |
186 |
|
|
190 | message = _("missing processor for flag '%#x'") % (flag) | |
187 |
|
|
191 | raise revlog._flagserrorclass(message) | |
188 |
|
192 | |||
189 |
|
|
193 | processor = revlog._flagprocessors[flag] | |
190 |
|
|
194 | if processor is not None: | |
191 |
|
|
195 | readtransform, writetransform, rawtransform = processor | |
192 |
|
196 | |||
193 |
|
|
197 | if operation == 'raw': | |
194 |
|
|
198 | vhash = rawtransform(revlog, text) | |
195 |
|
|
199 | elif operation == 'read': | |
196 |
|
|
200 | text, vhash, s = readtransform(revlog, text) | |
197 |
|
|
201 | outsidedata.update(s) | |
198 |
|
|
202 | else: # write operation | |
199 |
|
|
203 | text, vhash = writetransform(revlog, text, sidedata) | |
200 |
|
|
204 | validatehash = validatehash and vhash | |
201 |
|
205 | |||
202 |
|
|
206 | return text, validatehash, outsidedata |
General Comments 0
You need to be logged in to leave comments.
Login now