mercurial/dirstateutils/timestamp.py
changeset 48403 ca42667c8d26
parent 48398 111098af6356
child 48422 000130cfafb6
equal deleted inserted replaced
48402:be2317167a9b 48403:ca42667c8d26
   100 
   100 
   101     Otherwise a concurrent modification might happens with the same mtime.
   101     Otherwise a concurrent modification might happens with the same mtime.
   102     """
   102     """
   103     file_mtime = mtime_of(stat_result)
   103     file_mtime = mtime_of(stat_result)
   104     file_second = file_mtime[0]
   104     file_second = file_mtime[0]
       
   105     file_ns = file_mtime[1]
   105     boundary_second = present_mtime[0]
   106     boundary_second = present_mtime[0]
       
   107     boundary_ns = present_mtime[1]
   106     # If the mtime of the ambiguous file is younger (or equal) to the starting
   108     # If the mtime of the ambiguous file is younger (or equal) to the starting
   107     # point of the `status` walk, we cannot garantee that another, racy, write
   109     # point of the `status` walk, we cannot garantee that another, racy, write
   108     # will not happen right after with the same mtime and we cannot cache the
   110     # will not happen right after with the same mtime and we cannot cache the
   109     # information.
   111     # information.
   110     #
   112     #
   111     # However is the mtime is far away in the future, this is likely some
   113     # However if the mtime is far away in the future, this is likely some
   112     # mismatch between the current clock and previous file system operation. So
   114     # mismatch between the current clock and previous file system operation. So
   113     # mtime more than one days in the future are considered fine.
   115     # mtime more than one days in the future are considered fine.
   114     if boundary_second <= file_second < (3600 * 24 + boundary_second):
   116     if boundary_second == file_second:
       
   117         if file_ns and boundary_ns:
       
   118             if file_ns < boundary_ns:
       
   119                 return timestamp((file_second, file_ns, True))
       
   120         return None
       
   121     elif boundary_second < file_second < (3600 * 24 + boundary_second):
   115         return None
   122         return None
   116     else:
   123     else:
   117         return file_mtime
   124         return file_mtime