[PATCH 3 of 7] revlog: do not return raw cache blindly

Jun Wu quark at fb.com
Tue Mar 28 03:49:04 EDT 2017


# HG changeset patch
# User Jun Wu <quark at fb.com>
# Date 1490685397 25200
#      Tue Mar 28 00:16:37 2017 -0700
# Node ID d557aaee6ada70bf51fcc9d4d05d07a54d8f2d4e
# Parent  99cfe31d37df62b50e53a126f0eb31a1e352ac67
# Available At https://bitbucket.org/quark-zju/hg-draft
#              hg pull https://bitbucket.org/quark-zju/hg-draft -r d557aaee6ada
revlog: do not return raw cache blindly

Previously, revlog.revision(raw=False) may return raw content on cache hit.
That is wrong. This patch adds a check to fix it.

This slows down common use-cases where raw=False and flags=0. That
performance issue will be fixed later.

diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -1262,5 +1262,6 @@ class revlog(object):
         if self._cache:
             if self._cache[0] == node:
-                return self._cache[2]
+                if raw:
+                    return self._cache[2]
             cachedrev = self._cache[1]
 


More information about the Mercurial-devel mailing list