Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/revlog.py @ 32326:539cbe0f8fa3
flagprocessor: add a fast path when flags is 0
When flags is 0, _processflags could be a no-op instead of iterating through
the flag bits.
author | Jun Wu <quark@fb.com> |
---|---|
date | Wed, 10 May 2017 16:17:58 -0700 |
parents | 3de4c61b5087 |
children | bd872f64a8ba |
comparison
equal
deleted
inserted
replaced
32325:fe3105e6e051 | 32326:539cbe0f8fa3 |
---|---|
1357 returned text should be checked for hash integrity. | 1357 returned text should be checked for hash integrity. |
1358 | 1358 |
1359 Note: If the ``raw`` argument is set, it has precedence over the | 1359 Note: If the ``raw`` argument is set, it has precedence over the |
1360 operation and will only update the value of ``validatehash``. | 1360 operation and will only update the value of ``validatehash``. |
1361 """ | 1361 """ |
1362 # fast path: no flag processors will run | |
1363 if flags == 0: | |
1364 return text, True | |
1362 if not operation in ('read', 'write'): | 1365 if not operation in ('read', 'write'): |
1363 raise ProgrammingError(_("invalid '%s' operation ") % (operation)) | 1366 raise ProgrammingError(_("invalid '%s' operation ") % (operation)) |
1364 # Check all flags are known. | 1367 # Check all flags are known. |
1365 if flags & ~REVIDX_KNOWN_FLAGS: | 1368 if flags & ~REVIDX_KNOWN_FLAGS: |
1366 raise RevlogError(_("incompatible revision flag '%#x'") % | 1369 raise RevlogError(_("incompatible revision flag '%#x'") % |