tidy up mtime patch of andrea, get back half of performance loss.
authorVadim Gelfer <vadim.gelfer@gmail.com>
Tue, 20 Jun 2006 09:11:41 -0700
changeset 2461 ff9ee834e3b6
parent 2460 605e26a2e96e
child 2462 d610bcfd66a8
tidy up mtime patch of andrea, get back half of performance loss. this makes diff < 3% slower than before.
mercurial/commands.py
--- a/mercurial/commands.py	Tue Jun 20 15:37:41 2006 +0200
+++ b/mercurial/commands.py	Tue Jun 20 09:11:41 2006 -0700
@@ -8,7 +8,7 @@
 from demandload import demandload
 from node import *
 from i18n import gettext as _
-demandload(globals(), "os re sys signal shutil imp urllib pdb stat")
+demandload(globals(), "os re sys signal shutil imp urllib pdb")
 demandload(globals(), "fancyopts ui hg util lock revlog templater bundlerepo")
 demandload(globals(), "fnmatch mdiff random signal tempfile time")
 demandload(globals(), "traceback errno socket version struct atexit sets bz2")
@@ -385,16 +385,14 @@
         def read(f):
             return repo.file(f).read(mmap2[f])
     else:
+        tz = util.makedate()[1]
         _date2 = util.datestr()
-        _tz = util.makedate()[1]
         def date2(f):
             try:
-                _f = repo.wopener(f)
+                return util.datestr((os.lstat(repo.wjoin(f)).st_mtime, tz))
             except IOError, err:
-                if err[0] != errno.ENOENT:
-                    raise
+                if err.errno != errno.ENOENT: raise
                 return _date2
-            return util.datestr((os.fstat(_f.fileno())[stat.ST_MTIME], _tz))
         def read(f):
             return repo.wread(f)