##// END OF EJS Templates
flagprocessors: have the read transform function return side data (API)...
marmoute -
r43255:bd5858c2 default
parent child Browse files
Show More
@@ -104,7 +104,7 b' def readfromstore(self, text):'
104 if hgmeta or text.startswith('\1\n'):
104 if hgmeta or text.startswith('\1\n'):
105 text = storageutil.packmeta(hgmeta, text)
105 text = storageutil.packmeta(hgmeta, text)
106
106
107 return (text, True)
107 return (text, True, {})
108
108
109 def writetostore(self, text):
109 def writetostore(self, text):
110 # hg filelog metadata (includes rename, etc)
110 # hg filelog metadata (includes rename, etc)
@@ -113,7 +113,7 b" rustdagop = policy.importrust(r'dagop')"
113
113
114 # Flag processors for REVIDX_ELLIPSIS.
114 # Flag processors for REVIDX_ELLIPSIS.
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):
119 return text, False
119 return text, False
@@ -192,7 +192,8 b' class flagprocessorsmixin(object):'
192 if operation == 'raw':
192 if operation == 'raw':
193 vhash = rawtransform(self, text)
193 vhash = rawtransform(self, text)
194 elif operation == 'read':
194 elif operation == 'read':
195 text, vhash = readtransform(self, text)
195 text, vhash, s = readtransform(self, text)
196 outsidedata.update(s)
196 else: # write operation
197 else: # write operation
197 text, vhash = writetransform(self, text)
198 text, vhash = writetransform(self, text)
198 validatehash = validatehash and vhash
199 validatehash = validatehash and vhash
@@ -33,17 +33,20 b' def bypass(self, text):'
33 def noopdonothing(self, text):
33 def noopdonothing(self, text):
34 return (text, True)
34 return (text, True)
35
35
36 def noopdonothingread(self, text):
37 return (text, True, {})
38
36 def b64encode(self, text):
39 def b64encode(self, text):
37 return (base64.b64encode(text), False)
40 return (base64.b64encode(text), False)
38
41
39 def b64decode(self, text):
42 def b64decode(self, text):
40 return (base64.b64decode(text), True)
43 return (base64.b64decode(text), True, {})
41
44
42 def gzipcompress(self, text):
45 def gzipcompress(self, text):
43 return (zlib.compress(text), False)
46 return (zlib.compress(text), False)
44
47
45 def gzipdecompress(self, text):
48 def gzipdecompress(self, text):
46 return (zlib.decompress(text), True)
49 return (zlib.decompress(text), True, {})
47
50
48 def supportedoutgoingversions(orig, repo):
51 def supportedoutgoingversions(orig, repo):
49 versions = orig(repo)
52 versions = orig(repo)
@@ -116,7 +119,7 b' def extsetup(ui):'
116 flagutil.addflagprocessor(
119 flagutil.addflagprocessor(
117 REVIDX_NOOP,
120 REVIDX_NOOP,
118 (
121 (
119 noopdonothing,
122 noopdonothingread,
120 noopdonothing,
123 noopdonothing,
121 validatehash,
124 validatehash,
122 )
125 )
@@ -45,7 +45,7 b' def abort(msg):'
45 def readprocessor(self, rawtext):
45 def readprocessor(self, rawtext):
46 # True: the returned text could be used to verify hash
46 # True: the returned text could be used to verify hash
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):
51 # False: the returned rawtext shouldn't be used to verify hash
51 # False: the returned rawtext shouldn't be used to verify hash
General Comments 0
You need to be logged in to leave comments. Login now