revlog: drop local assignment of cache variable
authorGregory Szorc <gregory.szorc@gmail.com>
Sat, 12 Sep 2015 15:16:47 -0700
changeset 26242 d708873f1f33
parent 26241 eb97d49768cc
child 26243 836291420d53
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.
mercurial/revlog.py
--- a/mercurial/revlog.py	Sat Sep 12 12:47:00 2015 -0700
+++ b/mercurial/revlog.py	Sat Sep 12 15:16:47 2015 -0700
@@ -1049,14 +1049,13 @@
             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
@@ -1084,7 +1083,7 @@
 
         if iterrev == cachedrev:
             # cache hit
-            text = _cache[2]
+            text = self._cache[2]
         else:
             chain.append(iterrev)
         chain.reverse()