Mercurial > hg
changeset 27398:c81675776c95
dirstate: only invoke delaywrite if relevant
This avoids a significant amount of sleeping in some of our longest
tests.
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Wed, 16 Dec 2015 20:49:18 -0600 |
parents | 6c6b48aca328 |
children | 425dc70037f7 |
files | mercurial/dirstate.py |
diffstat | 1 files changed, 6 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/dirstate.py Wed Dec 16 20:46:53 2015 -0600 +++ b/mercurial/dirstate.py Wed Dec 16 20:49:18 2015 -0600 @@ -708,8 +708,12 @@ # timestamp of each entries in dirstate, because of 'now > mtime' delaywrite = self._ui.configint('debug', 'dirstate.delaywrite', 0) if delaywrite > 0: - import time # to avoid useless import - time.sleep(delaywrite) + # do we have any files to delay for? + for f, e in self._map.iteritems(): + if e[0] == 'n' and e[3] == now: + import time # to avoid useless import + time.sleep(delaywrite) + break st.write(parsers.pack_dirstate(self._map, self._copymap, self._pl, now)) st.close()