[PATCH 1 of 5 STABLE] filecache: pass func name that constructs the full path of the given file
Idan Kamara
idankk86 at gmail.com
Tue Feb 28 15:53:32 UTC 2012
# HG changeset patch
# User Idan Kamara <idankk86 at gmail.com>
# Date 1330444187 -7200
# Branch stable
# Node ID 94da74854f8123af5f81c1a996352fdaeffb23d5
# Parent de7aec5079bdaaae8509ec74a57fc2cb2c160371
filecache: pass func name that constructs the full path of the given file
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -176,7 +176,7 @@
def _writebookmarks(self, marks):
bookmarks.write(self)
- @filecache('phaseroots', True)
+ @filecache('phaseroots', 'sjoin')
def _phaseroots(self):
self._dirtyphases = False
phaseroots = phases.readroots(self)
@@ -195,7 +195,7 @@
cache[rev] = phase
return cache
- @filecache('00changelog.i', True)
+ @filecache('00changelog.i', 'sjoin')
def changelog(self):
c = changelog.changelog(self.sopener)
if 'HG_PENDING' in os.environ:
@@ -204,7 +204,7 @@
c.readpending('00changelog.i.a')
return c
- @filecache('00manifest.i', True)
+ @filecache('00manifest.i', 'sjoin')
def manifest(self):
return manifest.manifest(self.sopener)
diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
--- a/mercurial/scmutil.py
+++ b/mercurial/scmutil.py
@@ -793,9 +793,9 @@
to tell us if a file has been replaced. If it can't, we fallback to
recreating the object on every call (essentially the same behaviour as
propertycache).'''
- def __init__(self, path, instore=False):
+ def __init__(self, path, joinfunc='join'):
self.path = path
- self.instore = instore
+ self.joinfunc = joinfunc
def __call__(self, func):
self.func = func
@@ -813,7 +813,7 @@
if entry.changed():
entry.obj = self.func(obj)
else:
- path = self.instore and obj.sjoin(self.path) or obj.join(self.path)
+ path = getattr(obj, self.joinfunc)(self.path)
# We stat -before- creating the object so our cache doesn't lie if
# a writer modified between the time we read and stat
More information about the Mercurial-devel
mailing list