[PATCH 2 of 3] revlog: drop local assignment of cache variable
Gregory Szorc
gregory.szorc at gmail.com
Sat Sep 12 18:56:11 CDT 2015
# HG changeset patch
# User Gregory Szorc <gregory.szorc at gmail.com>
# Date 1442096207 25200
# Sat Sep 12 15:16:47 2015 -0700
# Node ID 9b0f250a7ac06af053725d735aa551eed9d3e66b
# Parent 40de7615bcdb6715732f3ac64b76c62bfe954387
revlog: drop local assignment of cache variable
The purpose of this code was to provide thread safety. With the
conversion of hgweb to use separate localrepository instances per
request/thread, we should no longer have any consumers that need to
access revlog instances from multiple threads. Remove the code.
diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -1048,16 +1048,15 @@ class revlog(object):
else:
node = nodeorrev
rev = None
- _cache = self._cache # grab local copy of cache to avoid thread race
cachedrev = None
if node == nullid:
return ""
- if _cache:
- if _cache[0] == node:
- return _cache[2]
- cachedrev = _cache[1]
+ if self._cache:
+ if self._cache[0] == node:
+ return self._cache[2]
+ cachedrev = self._cache[1]
# look up what we need to read
text = None
if rev is None:
@@ -1083,9 +1082,9 @@ class revlog(object):
e = index[iterrev]
if iterrev == cachedrev:
# cache hit
- text = _cache[2]
+ text = self._cache[2]
else:
chain.append(iterrev)
chain.reverse()
More information about the Mercurial-devel
mailing list