mercurial/localrepo.py
changeset 33382 b107a7660f4e
parent 33373 fb320398a21c
child 33389 7e89bd0cfb86
--- a/mercurial/localrepo.py	Mon Jul 10 21:09:46 2017 -0700
+++ b/mercurial/localrepo.py	Mon Jul 10 23:09:51 2017 +0900
@@ -104,6 +104,16 @@
     def join(self, obj, fname):
         return obj.sjoin(fname)
 
+def isfilecached(repo, name):
+    """check if a repo has already cached "name" filecache-ed property
+
+    This returns (cachedobj-or-None, iscached) tuple.
+    """
+    cacheentry = repo.unfiltered()._filecache.get(name, None)
+    if not cacheentry:
+        return None, False
+    return cacheentry.obj, True
+
 class unfilteredpropertycache(util.propertycache):
     """propertycache that apply to unfiltered repo only"""