Changeset 62e8c373c24c…
Parent 527ba14b2508…
by
Changes to 2 files · Browse files at 62e8c373c24c Showing diff from parent 527ba14b2508 Diff from another changeset...
@@ -546,12 +546,11 @@ _pctxcache = {}
def genPatchContext(repo, patchpath, rev=None):
global _pctxcache
- holder = _pctxcache.get(patchpath, None)
- if os.path.exists(patchpath):
- mtime = os.path.getmtime(patchpath)
- if holder is not None and mtime == holder[0]:
- return holder[1]
+ if os.path.exists(patchpath) and patchpath in _pctxcache:
+ cachedctx = _pctxcache[patchpath]
+ if cachedctx._mtime == os.path.getmtime(patchpath):
+ return cachedctx
# create a new context object
ctx = patchctx(patchpath, repo, rev=rev)
- _pctxcache[patchpath] = (mtime, ctx)
+ _pctxcache[patchpath] = ctx
return ctx
|
@@ -37,10 +37,12 @@ self._desc = ''
self._branch = ''
self._node = node.nullid
+ self._mtime = None
try:
ph = mq.patchheader(self._path)
self._ph = ph
+ self._mtime = os.path.getmtime(patchpath)
except EnvironmentError:
return
|
Loading...