mercurial/dirstate.py
changeset 48379 08b060abd658
parent 48378 3d6eb119200d
child 48384 9f1b9e128788
equal deleted inserted replaced
48378:3d6eb119200d 48379:08b060abd658
    62 class rootcache(filecache):
    62 class rootcache(filecache):
    63     """filecache for files in the repository root"""
    63     """filecache for files in the repository root"""
    64 
    64 
    65     def join(self, obj, fname):
    65     def join(self, obj, fname):
    66         return obj._join(fname)
    66         return obj._join(fname)
    67 
       
    68 
       
    69 def _getfsnow(vfs):
       
    70     '''Get "now" timestamp on filesystem'''
       
    71     tmpfd, tmpname = vfs.mkstemp()
       
    72     try:
       
    73         return timestamp.mtime_of(os.fstat(tmpfd))
       
    74     finally:
       
    75         os.close(tmpfd)
       
    76         vfs.unlink(tmpname)
       
    77 
    67 
    78 
    68 
    79 def requires_parents_change(func):
    69 def requires_parents_change(func):
    80     def wrap(self, *args, **kwargs):
    70     def wrap(self, *args, **kwargs):
    81         if not self.pendingparentchange():
    71         if not self.pendingparentchange():
   785             # delayed writing re-raise "ambiguous timestamp issue".
   775             # delayed writing re-raise "ambiguous timestamp issue".
   786             # See also the wiki page below for detail:
   776             # See also the wiki page below for detail:
   787             # https://www.mercurial-scm.org/wiki/DirstateTransactionPlan
   777             # https://www.mercurial-scm.org/wiki/DirstateTransactionPlan
   788 
   778 
   789             # record when mtime start to be ambiguous
   779             # record when mtime start to be ambiguous
   790             now = _getfsnow(self._opener)
   780             now = timestamp.get_fs_now(self._opener)
   791 
   781 
   792             # delay writing in-memory changes out
   782             # delay writing in-memory changes out
   793             tr.addfilegenerator(
   783             tr.addfilegenerator(
   794                 b'dirstate',
   784                 b'dirstate',
   795                 (self._filename,),
   785                 (self._filename,),