##// END OF EJS Templates
flagprocessors: writetransform function take side data as parameter (API)...
marmoute -
r43258:f4caf910 default
parent child Browse files
Show More
@@ -106,7 +106,7 b' def readfromstore(self, text):'
106
106
107 return (text, True, {})
107 return (text, True, {})
108
108
109 def writetostore(self, text):
109 def writetostore(self, text, sidedata):
110 # hg filelog metadata (includes rename, etc)
110 # hg filelog metadata (includes rename, etc)
111 hgmeta, offset = storageutil.parsemeta(text)
111 hgmeta, offset = storageutil.parsemeta(text)
112 if offset and offset > 0:
112 if offset and offset > 0:
@@ -115,7 +115,7 b" rustdagop = policy.importrust(r'dagop')"
115 def ellipsisreadprocessor(rl, text):
115 def ellipsisreadprocessor(rl, text):
116 return text, False, {}
116 return text, False, {}
117
117
118 def ellipsiswriteprocessor(rl, text):
118 def ellipsiswriteprocessor(rl, text, sidedata):
119 return text, False
119 return text, False
120
120
121 def ellipsisrawprocessor(rl, text):
121 def ellipsisrawprocessor(rl, text):
@@ -136,8 +136,8 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 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
@@ -157,7 +157,7 b' class flagprocessorsmixin(object):'
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, {}
@@ -196,7 +196,7 b' class flagprocessorsmixin(object):'
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
@@ -30,19 +30,19 b' def validatehash(self, text):'
30 def bypass(self, text):
30 def bypass(self, text):
31 return False
31 return False
32
32
33 def noopdonothing(self, text):
33 def noopdonothing(self, text, sidedata):
34 return (text, True)
34 return (text, True)
35
35
36 def noopdonothingread(self, text):
36 def noopdonothingread(self, text):
37 return (text, True, {})
37 return (text, True, {})
38
38
39 def b64encode(self, text):
39 def b64encode(self, text, sidedata):
40 return (base64.b64encode(text), False)
40 return (base64.b64encode(text), False)
41
41
42 def b64decode(self, text):
42 def b64decode(self, text):
43 return (base64.b64decode(text), True, {})
43 return (base64.b64decode(text), True, {})
44
44
45 def gzipcompress(self, text):
45 def gzipcompress(self, text, sidedata):
46 return (zlib.compress(text), False)
46 return (zlib.compress(text), False)
47
47
48 def gzipdecompress(self, text):
48 def gzipdecompress(self, text):
@@ -47,7 +47,7 b' def readprocessor(self, rawtext):'
47 text = rawtext[len(_extheader):].replace(b'i', b'1')
47 text = rawtext[len(_extheader):].replace(b'i', b'1')
48 return text, True, {}
48 return text, True, {}
49
49
50 def writeprocessor(self, text):
50 def writeprocessor(self, text, sidedata):
51 # False: the returned rawtext shouldn't be used to verify hash
51 # False: the returned rawtext shouldn't be used to verify hash
52 rawtext = _extheader + text.replace(b'1', b'i')
52 rawtext = _extheader + text.replace(b'1', b'i')
53 return rawtext, False
53 return rawtext, False
@@ -262,7 +262,7 b' def writecases(rlog, tr):'
262
262
263 # Verify text, rawtext, and rawsize
263 # Verify text, rawtext, and rawsize
264 if isext:
264 if isext:
265 rawtext = writeprocessor(None, text)[0]
265 rawtext = writeprocessor(None, text, {})[0]
266 else:
266 else:
267 rawtext = text
267 rawtext = text
268 if rlog.rawsize(rev) != len(rawtext):
268 if rlog.rawsize(rev) != len(rawtext):
General Comments 0
You need to be logged in to leave comments. Login now