mercurial/revlogutils/flagutil.py
changeset 42988 f4caf910669e
parent 42987 36a0a1951d64
child 42989 50d9de61ce02
equal deleted inserted replaced
42987:36a0a1951d64 42988:f4caf910669e
   134 
   134 
   135         Returns a 2-tuple of ``(text, validatehash)`` where ``text`` is the
   135         Returns a 2-tuple of ``(text, validatehash)`` where ``text`` is the
   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         assert not sidedata # XXX until it is actually processed
   139         return self._processflagsfunc(text, flags, 'write',
   140         return self._processflagsfunc(text, flags, 'write')[:2]
   140                                       sidedata=sidedata)[:2]
   141 
   141 
   142     def _processflagsraw(self, text, flags):
   142     def _processflagsraw(self, text, flags):
   143         """Inspect revision data flags to check is the content hash should be
   143         """Inspect revision data flags to check is the content hash should be
   144         validated.
   144         validated.
   145 
   145 
   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 self._processflagsfunc(text, flags, 'raw')[1]
   158         return self._processflagsfunc(text, flags, 'raw')[1]
   159 
   159 
   160     def _processflagsfunc(self, text, flags, operation):
   160     def _processflagsfunc(self, text, flags, operation, sidedata=None):
   161         # fast path: no flag processors will run
   161         # fast path: no flag processors will run
   162         if flags == 0:
   162         if flags == 0:
   163             return text, True, {}
   163             return text, True, {}
   164         if operation not in ('read', 'write', 'raw'):
   164         if operation not in ('read', 'write', 'raw'):
   165             raise error.ProgrammingError(_("invalid '%s' operation") %
   165             raise error.ProgrammingError(_("invalid '%s' operation") %
   194                         vhash = rawtransform(self, text)
   194                         vhash = rawtransform(self, text)
   195                     elif operation == 'read':
   195                     elif operation == 'read':
   196                         text, vhash, s = readtransform(self, text)
   196                         text, vhash, s = readtransform(self, text)
   197                         outsidedata.update(s)
   197                         outsidedata.update(s)
   198                     else: # write operation
   198                     else: # write operation
   199                         text, vhash = writetransform(self, text)
   199                         text, vhash = writetransform(self, text, sidedata)
   200                 validatehash = validatehash and vhash
   200                 validatehash = validatehash and vhash
   201 
   201 
   202         return text, validatehash, outsidedata
   202         return text, validatehash, outsidedata