mercurial/dirstate.py
changeset 43477 ed50f2c31a4c
parent 43281 6230c70a1863
child 43508 ab9b0a20b9e6
equal deleted inserted replaced
43476:0836efe4967b 43477:ed50f2c31a4c
   685         # enough 'delaywrite' prevents 'pack_dirstate' from dropping
   685         # enough 'delaywrite' prevents 'pack_dirstate' from dropping
   686         # timestamp of each entries in dirstate, because of 'now > mtime'
   686         # timestamp of each entries in dirstate, because of 'now > mtime'
   687         delaywrite = self._ui.configint(b'debug', b'dirstate.delaywrite')
   687         delaywrite = self._ui.configint(b'debug', b'dirstate.delaywrite')
   688         if delaywrite > 0:
   688         if delaywrite > 0:
   689             # do we have any files to delay for?
   689             # do we have any files to delay for?
   690             items = pycompat.iteritems(self._map)
   690             for f, e in pycompat.iteritems(self._map):
   691             for f, e in items:
       
   692                 if e[0] == b'n' and e[3] == now:
   691                 if e[0] == b'n' and e[3] == now:
   693                     import time  # to avoid useless import
   692                     import time  # to avoid useless import
   694 
   693 
   695                     # rather than sleep n seconds, sleep until the next
   694                     # rather than sleep n seconds, sleep until the next
   696                     # multiple of n seconds
   695                     # multiple of n seconds
   698                     start = int(clock) - (int(clock) % delaywrite)
   697                     start = int(clock) - (int(clock) % delaywrite)
   699                     end = start + delaywrite
   698                     end = start + delaywrite
   700                     time.sleep(end - clock)
   699                     time.sleep(end - clock)
   701                     now = end  # trust our estimate that the end is near now
   700                     now = end  # trust our estimate that the end is near now
   702                     break
   701                     break
   703             # since the iterator is potentially not deleted,
       
   704             # delete the iterator to release the reference for the Rust
       
   705             # implementation.
       
   706             # TODO make the Rust implementation behave like Python
       
   707             # since this would not work with a non ref-counting GC.
       
   708             del items
       
   709 
   702 
   710         self._map.write(st, now)
   703         self._map.write(st, now)
   711         self._lastnormaltime = 0
   704         self._lastnormaltime = 0
   712         self._dirty = False
   705         self._dirty = False
   713 
   706