Show More
@@ -1660,7 +1660,7 b' class revlog(flagutil.flagprocessorsmixi' | |||
|
1660 | 1660 | |
|
1661 | 1661 | sidedata = {} |
|
1662 | 1662 | if raw: |
|
1663 |
validatehash = self |
|
|
1663 | validatehash = flagutil.processflagsraw(self, rawtext, flags) | |
|
1664 | 1664 | text = rawtext |
|
1665 | 1665 | else: |
|
1666 | 1666 | r = flagutil.processflagsread(self, rawtext, flags) |
@@ -33,6 +33,10 b' from .. import (' | |||
|
33 | 33 | util, |
|
34 | 34 | ) |
|
35 | 35 | |
|
36 | from . import ( | |
|
37 | flagutil, | |
|
38 | ) | |
|
39 | ||
|
36 | 40 | # maximum <delta-chain-data>/<revision-text-length> ratio |
|
37 | 41 | LIMIT_DELTA2TEXT = 2 |
|
38 | 42 | |
@@ -521,7 +525,7 b' def _textfromdelta(fh, revlog, baserev, ' | |||
|
521 | 525 | fulltext = mdiff.patch(basetext, delta) |
|
522 | 526 | |
|
523 | 527 | try: |
|
524 |
validatehash = revlog |
|
|
528 | validatehash = flagutil.processflagsraw(revlog, fulltext, flags) | |
|
525 | 529 | if validatehash: |
|
526 | 530 | revlog.checkhash(fulltext, expectednode, p1=p1, p2=p2) |
|
527 | 531 | if flags & REVIDX_ISCENSORED: |
@@ -94,30 +94,12 b' class flagprocessorsmixin(object):' | |||
|
94 | 94 | msg = ('_processflag(...) use the specialized variant') |
|
95 | 95 | util.nouideprecwarn(msg, '5.2', stacklevel=2) |
|
96 | 96 | if raw: |
|
97 |
return text, self |
|
|
97 | return text, processflagsraw(self, text, flags) | |
|
98 | 98 | elif operation == 'read': |
|
99 | 99 | return processflagsread(self, text, flags) |
|
100 | 100 | else: # write operation |
|
101 | 101 | return processflagswrite(self, text, flags) |
|
102 | 102 | |
|
103 | def _processflagsraw(self, text, flags): | |
|
104 | """Inspect revision data flags to check is the content hash should be | |
|
105 | validated. | |
|
106 | ||
|
107 | ``text`` - the revision data to process | |
|
108 | ``flags`` - the revision flags | |
|
109 | ||
|
110 | This method processes the flags in the order (or reverse order if | |
|
111 | ``operation`` is 'write') defined by REVIDX_FLAGS_ORDER, applying the | |
|
112 | flag processors registered for present flags. The order of flags defined | |
|
113 | in REVIDX_FLAGS_ORDER needs to be stable to allow non-commutativity. | |
|
114 | ||
|
115 | Returns a 2-tuple of ``(text, validatehash)`` where ``text`` is the | |
|
116 | processed text and ``validatehash`` is a bool indicating whether the | |
|
117 | returned text should be checked for hash integrity. | |
|
118 | """ | |
|
119 | return _processflagsfunc(self, text, flags, 'raw')[1] | |
|
120 | ||
|
121 | 103 | def processflagswrite(revlog, text, flags, sidedata): |
|
122 | 104 | """Inspect revision data flags and applies write transformations defined |
|
123 | 105 | by registered flag processors. |
@@ -157,6 +139,24 b' def processflagsread(revlog, text, flags' | |||
|
157 | 139 | """ |
|
158 | 140 | return _processflagsfunc(revlog, text, flags, 'read') |
|
159 | 141 | |
|
142 | def processflagsraw(revlog, text, flags): | |
|
143 | """Inspect revision data flags to check is the content hash should be | |
|
144 | validated. | |
|
145 | ||
|
146 | ``text`` - the revision data to process | |
|
147 | ``flags`` - the revision flags | |
|
148 | ||
|
149 | This method processes the flags in the order (or reverse order if | |
|
150 | ``operation`` is 'write') defined by REVIDX_FLAGS_ORDER, applying the | |
|
151 | flag processors registered for present flags. The order of flags defined | |
|
152 | in REVIDX_FLAGS_ORDER needs to be stable to allow non-commutativity. | |
|
153 | ||
|
154 | Returns a 2-tuple of ``(text, validatehash)`` where ``text`` is the | |
|
155 | processed text and ``validatehash`` is a bool indicating whether the | |
|
156 | returned text should be checked for hash integrity. | |
|
157 | """ | |
|
158 | return _processflagsfunc(revlog, text, flags, 'raw')[1] | |
|
159 | ||
|
160 | 160 | def _processflagsfunc(revlog, text, flags, operation, sidedata=None): |
|
161 | 161 | """internal function to process flag on a revlog |
|
162 | 162 |
@@ -291,7 +291,7 b' class filestorage(flagutil.flagprocessor' | |||
|
291 | 291 | rawtext = self._svfs.read(path) |
|
292 | 292 | |
|
293 | 293 | if raw: |
|
294 |
validatehash = self |
|
|
294 | validatehash = flagutil.processflagsraw(self, rawtext, flags) | |
|
295 | 295 | text = rawtext |
|
296 | 296 | else: |
|
297 | 297 | r = flagutil.processflagsread(self, rawtext, flags) |
General Comments 0
You need to be logged in to leave comments.
Login now