# HG changeset patch # User Jun Wu # Date 1490934075 25200 # Node ID 9ec03d5af48f9dbf0f67e36254bc853044105519 # Parent ec48d57de11030a2756f4049f094626f1a100767 revlog: add a fast path for revision(raw=False) If cache hit and flags are empty, no flag processor runs and "text" equals to "rawtext". So we check flags, and return rawtext. This resolves performance issue introduced by a previous patch. diff -r ec48d57de110 -r 9ec03d5af48f mercurial/revlog.py --- a/mercurial/revlog.py Thu Mar 30 18:38:03 2017 -0700 +++ b/mercurial/revlog.py Thu Mar 30 21:21:15 2017 -0700 @@ -1274,6 +1274,13 @@ # _cache only stores rawtext if raw: return self._cache[2] + # duplicated, but good for perf + if rev is None: + rev = self.rev(node) + # no extra flags set, no flag processor runs, text = rawtext + if self.flags(rev) == REVIDX_DEFAULT_FLAGS: + return self._cache[2] + cachedrev = self._cache[1] # look up what we need to read