Patchwork [4,of,8,"] manifestcache: skip setup earlier if we don't have the lock

login
register
mail settings
Submitter Pierre-Yves David
Date March 16, 2019, 10:36 a.m.
Message ID <79362091afef9fb409eb.1552732585@nodosa.octopoid.net>
Download mbox | patch
Permalink /patch/39284/
State Accepted
Headers show

Comments

Pierre-Yves David - March 16, 2019, 10:36 a.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@octobus.net>
# Date 1552640843 0
#      Fri Mar 15 09:07:23 2019 +0000
# Node ID 79362091afef9fb409ebe8385172ca2fa4aa4cd4
# Parent  6c22a53a7afe8b4b46989a62a71b7fc1c4e11ec6
# EXP-Topic manifestcache
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 79362091afef
manifestcache: skip setup earlier if we don't have the lock

There a no point preparing a closure if we are not going to use it.

Patch

diff --git a/mercurial/manifest.py b/mercurial/manifest.py
--- a/mercurial/manifest.py
+++ b/mercurial/manifest.py
@@ -1437,6 +1437,9 @@  class manifestrevlog(object):
             return
 
         self._fulltextcache._opener = repo.cachevfs
+        if repo._currentlock(repo._lockref) is None:
+            return
+
         reporef = weakref.ref(repo)
         manifestrevlogref = weakref.ref(self)
 
@@ -1450,8 +1453,7 @@  class manifestrevlog(object):
                 return
             self._fulltextcache.write()
 
-        if repo._currentlock(repo._lockref) is not None:
-            repo._afterlock(persistmanifestcache)
+        repo._afterlock(persistmanifestcache)
 
     @property
     def fulltextcache(self):