Show More
@@ -708,6 +708,7 b' def resolverevlogstorevfsoptions(ui, req' | |||||
708 | """Resolve opener options specific to revlogs.""" |
|
708 | """Resolve opener options specific to revlogs.""" | |
709 |
|
709 | |||
710 | options = {} |
|
710 | options = {} | |
|
711 | options[b'flagprocessors'] = {} | |||
711 |
|
712 | |||
712 | if b'revlogv1' in requirements: |
|
713 | if b'revlogv1' in requirements: | |
713 | options[b'revlogv1'] = True |
|
714 | options[b'revlogv1'] = True |
@@ -151,16 +151,19 b' def addflagprocessor(flag, processor):' | |||||
151 | debug commands. In this case the transform only indicates whether the |
|
151 | debug commands. In this case the transform only indicates whether the | |
152 | contents can be used for hash integrity checks. |
|
152 | contents can be used for hash integrity checks. | |
153 | """ |
|
153 | """ | |
|
154 | _insertflagprocessor(flag, processor, _flagprocessors) | |||
|
155 | ||||
|
156 | def _insertflagprocessor(flag, processor, flagprocessors): | |||
154 | if not flag & REVIDX_KNOWN_FLAGS: |
|
157 | if not flag & REVIDX_KNOWN_FLAGS: | |
155 | msg = _("cannot register processor on unknown flag '%#x'.") % (flag) |
|
158 | msg = _("cannot register processor on unknown flag '%#x'.") % (flag) | |
156 | raise error.ProgrammingError(msg) |
|
159 | raise error.ProgrammingError(msg) | |
157 | if flag not in REVIDX_FLAGS_ORDER: |
|
160 | if flag not in REVIDX_FLAGS_ORDER: | |
158 | msg = _("flag '%#x' undefined in REVIDX_FLAGS_ORDER.") % (flag) |
|
161 | msg = _("flag '%#x' undefined in REVIDX_FLAGS_ORDER.") % (flag) | |
159 | raise error.ProgrammingError(msg) |
|
162 | raise error.ProgrammingError(msg) | |
160 |
if flag in |
|
163 | if flag in flagprocessors: | |
161 | msg = _("cannot register multiple processors on flag '%#x'.") % (flag) |
|
164 | msg = _("cannot register multiple processors on flag '%#x'.") % (flag) | |
162 | raise error.Abort(msg) |
|
165 | raise error.Abort(msg) | |
163 |
|
|
166 | flagprocessors[flag] = processor | |
164 |
|
167 | |||
165 | def getoffset(q): |
|
168 | def getoffset(q): | |
166 | return int(q >> 16) |
|
169 | return int(q >> 16) | |
@@ -408,6 +411,10 b' class revlog(object):' | |||||
408 | if opts.get('enableellipsis'): |
|
411 | if opts.get('enableellipsis'): | |
409 | self._flagprocessors[REVIDX_ELLIPSIS] = ellipsisprocessor |
|
412 | self._flagprocessors[REVIDX_ELLIPSIS] = ellipsisprocessor | |
410 |
|
413 | |||
|
414 | # revlog v0 doesn't have flag processors | |||
|
415 | for flag, processor in opts.get(b'flagprocessors', {}).iteritems(): | |||
|
416 | _insertflagprocessor(flag, processor, self._flagprocessors) | |||
|
417 | ||||
411 | if self._chunkcachesize <= 0: |
|
418 | if self._chunkcachesize <= 0: | |
412 | raise error.RevlogError(_('revlog chunk cache size %r is not ' |
|
419 | raise error.RevlogError(_('revlog chunk cache size %r is not ' | |
413 | 'greater than 0') % self._chunkcachesize) |
|
420 | 'greater than 0') % self._chunkcachesize) |
@@ -206,6 +206,8 b' Ensure the data got to the server OK' | |||||
206 | File "*/tests/flagprocessorext.py", line *, in extsetup (glob) |
|
206 | File "*/tests/flagprocessorext.py", line *, in extsetup (glob) | |
207 | validatehash, |
|
207 | validatehash, | |
208 | File "*/mercurial/revlog.py", line *, in addflagprocessor (glob) |
|
208 | File "*/mercurial/revlog.py", line *, in addflagprocessor (glob) | |
|
209 | _insertflagprocessor(flag, processor, _flagprocessors) | |||
|
210 | File "*/mercurial/revlog.py", line *, in _insertflagprocessor (glob) | |||
209 | raise error.Abort(msg) |
|
211 | raise error.Abort(msg) | |
210 | Abort: cannot register multiple processors on flag '0x8'. |
|
212 | Abort: cannot register multiple processors on flag '0x8'. | |
211 | *** failed to set up extension duplicate: cannot register multiple processors on flag '0x8'. |
|
213 | *** failed to set up extension duplicate: cannot register multiple processors on flag '0x8'. |
General Comments 0
You need to be logged in to leave comments.
Login now