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