Show More
@@ -150,19 +150,7 b' def addflagprocessor(flag, processor):' | |||
|
150 | 150 | debug commands. In this case the transform only indicates whether the |
|
151 | 151 | contents can be used for hash integrity checks. |
|
152 | 152 | """ |
|
153 |
|
|
|
154 | ||
|
155 | def _insertflagprocessor(flag, processor, flagprocessors): | |
|
156 | if not flag & flagutil.REVIDX_KNOWN_FLAGS: | |
|
157 | msg = _("cannot register processor on unknown flag '%#x'.") % (flag) | |
|
158 | raise error.ProgrammingError(msg) | |
|
159 | if flag not in REVIDX_FLAGS_ORDER: | |
|
160 | msg = _("flag '%#x' undefined in REVIDX_FLAGS_ORDER.") % (flag) | |
|
161 | raise error.ProgrammingError(msg) | |
|
162 | if flag in flagprocessors: | |
|
163 | msg = _("cannot register multiple processors on flag '%#x'.") % (flag) | |
|
164 | raise error.Abort(msg) | |
|
165 | flagprocessors[flag] = processor | |
|
153 | flagutil.insertflagprocessor(flag, processor, flagutil.flagprocessors) | |
|
166 | 154 | |
|
167 | 155 | def getoffset(q): |
|
168 | 156 | return int(q >> 16) |
@@ -438,7 +426,7 b' class revlog(object):' | |||
|
438 | 426 | |
|
439 | 427 | # revlog v0 doesn't have flag processors |
|
440 | 428 | for flag, processor in opts.get(b'flagprocessors', {}).iteritems(): |
|
441 |
|
|
|
429 | flagutil.insertflagprocessor(flag, processor, self._flagprocessors) | |
|
442 | 430 | |
|
443 | 431 | if self._chunkcachesize <= 0: |
|
444 | 432 | raise error.RevlogError(_('revlog chunk cache size %r is not ' |
@@ -8,6 +8,8 b'' | |||
|
8 | 8 | |
|
9 | 9 | from __future__ import absolute_import |
|
10 | 10 | |
|
11 | from ..i18n import _ | |
|
12 | ||
|
11 | 13 | from .constants import ( |
|
12 | 14 | REVIDX_DEFAULT_FLAGS, |
|
13 | 15 | REVIDX_ELLIPSIS, |
@@ -18,6 +20,7 b' from .constants import (' | |||
|
18 | 20 | ) |
|
19 | 21 | |
|
20 | 22 | from .. import ( |
|
23 | error, | |
|
21 | 24 | util |
|
22 | 25 | ) |
|
23 | 26 | |
@@ -37,3 +40,14 b' flagprocessors = {' | |||
|
37 | 40 | REVIDX_ISCENSORED: None, |
|
38 | 41 | } |
|
39 | 42 | |
|
43 | def insertflagprocessor(flag, processor, flagprocessors): | |
|
44 | if not flag & REVIDX_KNOWN_FLAGS: | |
|
45 | msg = _("cannot register processor on unknown flag '%#x'.") % (flag) | |
|
46 | raise error.ProgrammingError(msg) | |
|
47 | if flag not in REVIDX_FLAGS_ORDER: | |
|
48 | msg = _("flag '%#x' undefined in REVIDX_FLAGS_ORDER.") % (flag) | |
|
49 | raise error.ProgrammingError(msg) | |
|
50 | if flag in flagprocessors: | |
|
51 | msg = _("cannot register multiple processors on flag '%#x'.") % (flag) | |
|
52 | raise error.Abort(msg) | |
|
53 | flagprocessors[flag] = processor |
@@ -206,8 +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 |
|
|
|
210 |
File "*/mercurial/revlog.py", line *, in |
|
|
209 | flagutil.insertflagprocessor(flag, processor, flagutil.flagprocessors) | |
|
210 | File "*/mercurial/revlogutils/flagutil.py", line *, in insertflagprocessor (glob) | |
|
211 | 211 | raise error.Abort(msg) |
|
212 | 212 | mercurial.error.Abort: b"cannot register multiple processors on flag '0x8'." (py3 !) |
|
213 | 213 | Abort: cannot register multiple processors on flag '0x8'. (no-py3 !) |
General Comments 0
You need to be logged in to leave comments.
Login now