92 def _processflags(self, text, flags, operation, raw=False): |
92 def _processflags(self, text, flags, operation, raw=False): |
93 """deprecated entry point to access flag processors""" |
93 """deprecated entry point to access flag processors""" |
94 msg = ('_processflag(...) use the specialized variant') |
94 msg = ('_processflag(...) use the specialized variant') |
95 util.nouideprecwarn(msg, '5.2', stacklevel=2) |
95 util.nouideprecwarn(msg, '5.2', stacklevel=2) |
96 if raw: |
96 if raw: |
97 return text, self._processflagsraw(text, flags) |
97 return text, processflagsraw(self, text, flags) |
98 elif operation == 'read': |
98 elif operation == 'read': |
99 return processflagsread(self, text, flags) |
99 return processflagsread(self, text, flags) |
100 else: # write operation |
100 else: # write operation |
101 return processflagswrite(self, text, flags) |
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 def processflagswrite(revlog, text, flags, sidedata): |
103 def processflagswrite(revlog, text, flags, sidedata): |
122 """Inspect revision data flags and applies write transformations defined |
104 """Inspect revision data flags and applies write transformations defined |
123 by registered flag processors. |
105 by registered flag processors. |
124 |
106 |
125 ``text`` - the revision data to process |
107 ``text`` - the revision data to process |
154 Returns a 2-tuple of ``(text, validatehash)`` where ``text`` is the |
136 Returns a 2-tuple of ``(text, validatehash)`` where ``text`` is the |
155 processed text and ``validatehash`` is a bool indicating whether the |
137 processed text and ``validatehash`` is a bool indicating whether the |
156 returned text should be checked for hash integrity. |
138 returned text should be checked for hash integrity. |
157 """ |
139 """ |
158 return _processflagsfunc(revlog, text, flags, 'read') |
140 return _processflagsfunc(revlog, text, flags, 'read') |
|
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 |
159 |
160 def _processflagsfunc(revlog, text, flags, operation, sidedata=None): |
160 def _processflagsfunc(revlog, text, flags, operation, sidedata=None): |
161 """internal function to process flag on a revlog |
161 """internal function to process flag on a revlog |
162 |
162 |
163 This function is private to this module, code should never needs to call it |
163 This function is private to this module, code should never needs to call it |