Show More
@@ -90,12 +90,20 b' class flagprocessorsmixin(object):' | |||
|
90 | 90 | _flagserrorclass = error.RevlogError |
|
91 | 91 | |
|
92 | 92 | def _processflags(self, text, flags, operation, raw=False): |
|
93 | """Inspect revision data flags and applies transforms defined by | |
|
94 | registered flag processors. | |
|
93 | """deprecated entry point to access flag processors""" | |
|
94 | if raw: | |
|
95 | return text, self._processflagsraw(text, flags) | |
|
96 | elif operation == 'read': | |
|
97 | return self._processflagsread(text, flags) | |
|
98 | else: # write operation | |
|
99 | return self._processflagswrite(text, flags) | |
|
100 | ||
|
101 | def _processflagsread(self, text, flags): | |
|
102 | """Inspect revision data flags and applies read transformations defined | |
|
103 | by registered flag processors. | |
|
95 | 104 | |
|
96 | 105 | ``text`` - the revision data to process |
|
97 | 106 | ``flags`` - the revision flags |
|
98 | ``operation`` - the operation being performed (read or write) | |
|
99 | 107 | ``raw`` - an optional argument describing if the raw transform should be |
|
100 | 108 | applied. |
|
101 | 109 | |
@@ -107,10 +115,46 b' class flagprocessorsmixin(object):' | |||
|
107 | 115 | Returns a 2-tuple of ``(text, validatehash)`` where ``text`` is the |
|
108 | 116 | processed text and ``validatehash`` is a bool indicating whether the |
|
109 | 117 | returned text should be checked for hash integrity. |
|
118 | """ | |
|
119 | return self._processflagsfunc(text, flags, 'read') | |
|
110 | 120 | |
|
111 | Note: If the ``raw`` argument is set, it has precedence over the | |
|
112 | operation and will only update the value of ``validatehash``. | |
|
121 | def _processflagswrite(self, text, flags): | |
|
122 | """Inspect revision data flags and applies write transformations defined | |
|
123 | by registered flag processors. | |
|
124 | ||
|
125 | ``text`` - the revision data to process | |
|
126 | ``flags`` - the revision flags | |
|
127 | ||
|
128 | This method processes the flags in the order (or reverse order if | |
|
129 | ``operation`` is 'write') defined by REVIDX_FLAGS_ORDER, applying the | |
|
130 | flag processors registered for present flags. The order of flags defined | |
|
131 | in REVIDX_FLAGS_ORDER needs to be stable to allow non-commutativity. | |
|
132 | ||
|
133 | Returns a 2-tuple of ``(text, validatehash)`` where ``text`` is the | |
|
134 | processed text and ``validatehash`` is a bool indicating whether the | |
|
135 | returned text should be checked for hash integrity. | |
|
113 | 136 | """ |
|
137 | return self._processflagsfunc(text, flags, 'write') | |
|
138 | ||
|
139 | def _processflagsraw(self, text, flags): | |
|
140 | """Inspect revision data flags to check is the content hash should be | |
|
141 | validated. | |
|
142 | ||
|
143 | ``text`` - the revision data to process | |
|
144 | ``flags`` - the revision flags | |
|
145 | ||
|
146 | This method processes the flags in the order (or reverse order if | |
|
147 | ``operation`` is 'write') defined by REVIDX_FLAGS_ORDER, applying the | |
|
148 | flag processors registered for present flags. The order of flags defined | |
|
149 | in REVIDX_FLAGS_ORDER needs to be stable to allow non-commutativity. | |
|
150 | ||
|
151 | Returns a 2-tuple of ``(text, validatehash)`` where ``text`` is the | |
|
152 | processed text and ``validatehash`` is a bool indicating whether the | |
|
153 | returned text should be checked for hash integrity. | |
|
154 | """ | |
|
155 | return self._processflagsfunc(text, flags, 'read', raw=True)[1] | |
|
156 | ||
|
157 | def _processflagsfunc(self, text, flags, operation, raw=False): | |
|
114 | 158 | # fast path: no flag processors will run |
|
115 | 159 | if flags == 0: |
|
116 | 160 | return text, True |
General Comments 0
You need to be logged in to leave comments.
Login now