[PATCH 7 of 7] revlog: avoid apply delta chain when cache hit in revlog.revision
Jun Wu
quark at fb.com
Tue Mar 28 03:49:08 EDT 2017
# HG changeset patch
# User Jun Wu <quark at fb.com>
# Date 1490683696 25200
# Mon Mar 27 23:48:16 2017 -0700
# Node ID 8c9f728ef3a3fff029d7fe6c875ed783c66dc254
# Parent d3d803ed16fe8e9d43f7a4daeca079e4022c297a
# Available At https://bitbucket.org/quark-zju/hg-draft
# hg pull https://bitbucket.org/quark-zju/hg-draft -r 8c9f728ef3a3
revlog: avoid apply delta chain when cache hit in revlog.revision
Previously, revlog.revision(raw=False) may try to apply the delta chain
even on cache hit. That could happen if flags are non-empty so all fast
paths won't be executed. But if cache hit, the raw test is still useful.
So let's use it.
diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -1259,19 +1259,20 @@ class revlog(object):
cachedrev = None
flags = None
+ text = None
if node == nullid:
return ""
if self._cache:
if self._cache[0] == node:
+ text = self._cache[2]
if raw:
- return self._cache[2]
+ return text
if rev is None:
rev = self.rev(node)
flags = self.flags(rev)
if not flags:
- return self._cache[2]
+ return text
cachedrev = self._cache[1]
# look up what we need to read
- text = None
if rev is None:
rev = self.rev(node)
More information about the Mercurial-devel
mailing list