Patchwork [3,of,3] dirstate: add debug message for debug.dirstate.delaywrite

login
register
mail settings
Submitter Mads Kiilerich
Date Oct. 18, 2016, 3:19 p.m.
Message ID <9329389e9dc752652f7c.1476803987@madski>
Download mbox | patch
Permalink /patch/17171/
State Accepted
Headers show

Comments

Mads Kiilerich - Oct. 18, 2016, 3:19 p.m.
# HG changeset patch
# User Mads Kiilerich <madski@unity3d.com>
# Date 1476803223 -7200
#      Tue Oct 18 17:07:03 2016 +0200
# Node ID 9329389e9dc752652f7c820255ca5afa346c4e08
# Parent  cde3cae17cba67f80b9f1b41e5cc5fe3b87cd06f
dirstate: add debug message for debug.dirstate.delaywrite

Show a message like:
  delaying dirstate write 0.305s to record that it was clean
which is kind of obscure but gives a hint that something is going on and helps
debugging. The functionality *is* obscure and I don't know a better way to
describe it briefly.
Mads Kiilerich - Oct. 18, 2016, 4:30 p.m.
On 10/18/2016 06:17 PM, Kevin Bullock wrote:
>> On Oct 18, 2016, at 10:19, Mads Kiilerich <mads@kiilerich.com> wrote:
>>
>> # HG changeset patch
>> # User Mads Kiilerich <madski@unity3d.com>
>> # Date 1476803223 -7200
>> #      Tue Oct 18 17:07:03 2016 +0200
>> # Node ID 9329389e9dc752652f7c820255ca5afa346c4e08
>> # Parent  cde3cae17cba67f80b9f1b41e5cc5fe3b87cd06f
>> dirstate: add debug message for debug.dirstate.delaywrite
> Is this series related to the intermittent test failure you described in <https://www.mercurial-scm.org/pipermail/mercurial-devel/2016-October/089501.html>?

No, I don't think so.

/Mads

Patch

diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py
--- a/mercurial/dirstate.py
+++ b/mercurial/dirstate.py
@@ -756,6 +756,8 @@  class dirstate(object):
                     clock = time.time()
                     start = int(clock) - (int(clock) % delaywrite)
                     end = start + delaywrite
+                    self._ui.debug('delaying dirstate write %0.3fs to record'
+                                   ' that it was clean\n' % (end - clock))
                     time.sleep(end - clock)
                     now = end # trust our estimate that the end is near now
                     break