Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 1.9.2, 1.9.3, and 2.0

patchctx: cache last read mtime in patchctx

Changeset 62e8c373c24c

Parent 527ba14b2508

by Steve Borho

Changes to 2 files · Browse files at 62e8c373c24c Showing diff from parent 527ba14b2508 Diff from another changeset...

 
546
547
548
549
550
551
552
553
 
 
 
 
554
555
556
 
557
 
546
547
548
 
 
 
 
 
549
550
551
552
553
554
 
555
556
@@ -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
38
39
 
40
41
42
43
 
44
45
46
 
37
38
39
40
41
42
43
44
45
46
47
48
@@ -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