Mercurial > hg
comparison tests/flagprocessorext.py @ 42985:bd5858c28bbe
flagprocessors: have the read transform function return side data (API)
This makes it possible for flag processors to -read- flag data.
Differential Revision: https://phab.mercurial-scm.org/D6813
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Wed, 04 Sep 2019 00:34:03 +0200 |
parents | 6d61be152c55 |
children | f4caf910669e |
comparison
equal
deleted
inserted
replaced
42984:66dc5a522f37 | 42985:bd5858c28bbe |
---|---|
31 return False | 31 return False |
32 | 32 |
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) |
50 versions.discard(b'01') | 53 versions.discard(b'01') |
51 versions.discard(b'02') | 54 versions.discard(b'02') |
114 | 117 |
115 # Register flag processors for each extension | 118 # Register flag processors for each extension |
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 ) |
123 ) | 126 ) |
124 flagutil.addflagprocessor( | 127 flagutil.addflagprocessor( |