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

csinfo: use global variable for cache

Changeset 6b103a943427

Parent 6c06c6dcd842

by Yuki KODAMA

Changes to one file · Browse files at 6b103a943427 Showing diff from parent 6c06c6dcd842 Diff from another changeset...

 
117
118
119
120
 
 
 
121
122
123
124
 
125
126
127
 
128
129
130
131
132
 
133
134
135
 
117
118
119
 
120
121
122
123
124
125
126
127
128
129
 
130
131
132
133
134
 
135
136
137
138
@@ -117,19 +117,22 @@
  ctx = None   return ctx   -def PatchContext(repo, patchpath, cache={}): +_pctxcache = {} + +def PatchContext(repo, patchpath):   # check path   if not os.path.isabs(patchpath) or not os.path.isfile(patchpath):   return None   # check cache + global _pctxcache   mtime = os.path.getmtime(patchpath)   key = repo.root + patchpath - holder = cache.get(key, None) + holder = _pctxcache.get(key, None)   if holder is not None and mtime == holder[0]:   return holder[1]   # create a new context object   ctx = patchctx(patchpath, repo) - cache[key] = (mtime, ctx) + _pctxcache[key] = (mtime, ctx)   return ctx    class patchctx(object):