[svn r38797] fixing the too global revision caching

--HG--
branch : trunk
This commit is contained in:
hpk 2007-02-14 12:02:16 +01:00
parent 09f7bc947d
commit 1fd940c579
1 changed files with 10 additions and 7 deletions

View File

@ -170,15 +170,18 @@ def get_rel_sourcepath(projpath, filename, default=None):
return default
return relpath
_rev = -1
def get_package_revision(packageroot):
global _rev
if _rev == -1:
_rev = None
def get_package_revision(packageroot, _revcache={}):
try:
rev = _revcache[packageroot]
except KeyError:
wc = py.path.svnwc(packageroot)
rev = None
if wc.check(versioned=True):
_rev = py.path.svnwc(packageroot).info().rev
return _rev
rev = py.path.svnwc(packageroot).info().rev
_revcache[packageroot] = rev
if packageroot.basename == "py":
assert rev is not None
return rev
# the PageBuilder classes take care of producing the docs (using the stuff
# above)