diff mercurial/dirstate.py @ 27016:448cbdab5883

util: drop statmtimesec We've globablly forced stat to return integer times which agrees with our extension code, so this is no longer needed. This speeds up status on mozilla-central substantially: $ hg perfstatus ! wall 0.190179 comb 0.180000 user 0.120000 sys 0.060000 (best of 53) $ hg perfstatus ! wall 0.275729 comb 0.270000 user 0.210000 sys 0.060000 (best of 36)
author Matt Mackall <mpm@selenic.com>
date Thu, 19 Nov 2015 13:15:17 -0600
parents af2663680e95
children 54ace3372f84
line wrap: on
line diff
--- a/mercurial/dirstate.py	Thu Nov 19 13:21:24 2015 -0600
+++ b/mercurial/dirstate.py	Thu Nov 19 13:15:17 2015 -0600
@@ -31,7 +31,7 @@
     '''Get "now" timestamp on filesystem'''
     tmpfd, tmpname = vfs.mkstemp()
     try:
-        return util.statmtimesec(os.fstat(tmpfd))
+        return os.fstat(tmpfd).st_mtime
     finally:
         os.close(tmpfd)
         vfs.unlink(tmpname)
@@ -471,7 +471,7 @@
     def normal(self, f):
         '''Mark a file normal and clean.'''
         s = os.lstat(self._join(f))
-        mtime = util.statmtimesec(s)
+        mtime = s.st_mtime
         self._addpath(f, 'n', s.st_mode,
                       s.st_size & _rangemask, mtime & _rangemask)
         if f in self._copymap:
@@ -704,7 +704,7 @@
     def _writedirstate(self, st):
         # use the modification time of the newly created temporary file as the
         # filesystem's notion of 'now'
-        now = util.statmtimesec(util.fstat(st)) & _rangemask
+        now = util.fstat(st).st_mtime & _rangemask
         st.write(parsers.pack_dirstate(self._map, self._copymap, self._pl, now))
         st.close()
         self._lastnormaltime = 0
@@ -1078,16 +1078,15 @@
             if not st and state in "nma":
                 dadd(fn)
             elif state == 'n':
-                mtime = util.statmtimesec(st)
                 if (size >= 0 and
                     ((size != st.st_size and size != st.st_size & _rangemask)
                      or ((mode ^ st.st_mode) & 0o100 and checkexec))
                     or size == -2 # other parent
                     or fn in copymap):
                     madd(fn)
-                elif time != mtime and time != mtime & _rangemask:
+                elif time != st.st_mtime and time != st.st_mtime & _rangemask:
                     ladd(fn)
-                elif mtime == lastnormaltime:
+                elif st.st_mtime == lastnormaltime:
                     # fn may have just been marked as normal and it may have
                     # changed in the same second without changing its size.
                     # This can happen if we quickly do multiple commits.