Changeset 53ca55f9aa39…
Parent 5c2699401a8e…
by
Changes to 2 files · Browse files at 53ca55f9aa39 Showing diff from parent 5c2699401a8e Diff from another changeset...
@@ -575,10 +575,14 @@ _pctxcache = {}
def genPatchContext(repo, patchpath, rev=None):
global _pctxcache
- if os.path.exists(patchpath) and patchpath in _pctxcache:
- cachedctx = _pctxcache[patchpath]
- if cachedctx._mtime == os.path.getmtime(patchpath):
- return cachedctx
+ try:
+ if os.path.exists(patchpath) and patchpath in _pctxcache:
+ cachedctx = _pctxcache[patchpath]
+ if cachedctx._mtime == os.path.getmtime(patchpath) and \
+ cachedctx._fsize == os.path.getsize(patchpath):
+ return cachedctx
+ except EnvironmentError:
+ pass
# create a new context object
ctx = patchctx(patchpath, repo, rev=rev)
_pctxcache[patchpath] = ctx
|
@@ -41,12 +41,14 @@ self._node = node.nullid
self._identity = node.nullid
self._mtime = None
+ self._fsize = 0
self._parseerror = None
try:
+ self._mtime = os.path.getmtime(patchpath)
+ self._fsize = os.path.getsize(patchpath)
ph = mq.patchheader(self._path)
self._ph = ph
- self._mtime = os.path.getmtime(patchpath)
hash = util.sha1(self._path)
hash.update(str(self._mtime))
self._identity = hash.digest()
|
Loading...