changeset 32286: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 fe3105e6e051
children df3cf9422e1b
files mercurial/revlog.py
diffstat 1 files changed, 3 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/revlog.py	Sat May 13 14:52:29 2017 -0700
+++ b/mercurial/revlog.py	Wed May 10 16:17:58 2017 -0700
@@ -1359,6 +1359,9 @@
         Note: If the ``raw`` argument is set, it has precedence over the
         operation and will only update the value of ``validatehash``.
         """
+        # fast path: no flag processors will run
+        if flags == 0:
+            return text, True
         if not operation in ('read', 'write'):
             raise ProgrammingError(_("invalid '%s' operation ") % (operation))
         # Check all flags are known.