776 |
776 |
777 if now is None: |
777 if now is None: |
778 # use the modification time of the newly created temporary file as the |
778 # use the modification time of the newly created temporary file as the |
779 # filesystem's notion of 'now' |
779 # filesystem's notion of 'now' |
780 now = timestamp.mtime_of(util.fstat(st)) |
780 now = timestamp.mtime_of(util.fstat(st)) |
781 |
|
782 # enough 'delaywrite' prevents 'pack_dirstate' from dropping |
|
783 # timestamp of each entries in dirstate, because of 'now > mtime' |
|
784 delaywrite = self._ui.configint(b'debug', b'dirstate.delaywrite') |
|
785 if delaywrite > 0: |
|
786 # do we have any files to delay for? |
|
787 for f, e in pycompat.iteritems(self._map): |
|
788 if e.need_delay(now): |
|
789 import time # to avoid useless import |
|
790 |
|
791 # rather than sleep n seconds, sleep until the next |
|
792 # multiple of n seconds |
|
793 clock = time.time() |
|
794 start = int(clock) - (int(clock) % delaywrite) |
|
795 end = start + delaywrite |
|
796 time.sleep(end - clock) |
|
797 # trust our estimate that the end is near now |
|
798 now = timestamp.timestamp((end, 0)) |
|
799 break |
|
800 |
781 |
801 self._map.write(tr, st, now) |
782 self._map.write(tr, st, now) |
802 self._dirty = False |
783 self._dirty = False |
803 |
784 |
804 def _dirignore(self, f): |
785 def _dirignore(self, f): |