From 1fd940c5794cc5afcb89d0ee07b47aa941cb3a28 Mon Sep 17 00:00:00 2001 From: hpk Date: Wed, 14 Feb 2007 12:02:16 +0100 Subject: [PATCH] [svn r38797] fixing the too global revision caching --HG-- branch : trunk --- py/apigen/htmlgen.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/py/apigen/htmlgen.py b/py/apigen/htmlgen.py index a7624ebee..5debccbf3 100644 --- a/py/apigen/htmlgen.py +++ b/py/apigen/htmlgen.py @@ -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)