[PATCH] blackbox: add configitem for format of log timestamps

2018-10-18 Thread Matthew DeVore

# HG changeset patch
# User Matt DeVore 
# Date 1539816481 25200
#  Wed Oct 17 15:48:01 2018 -0700
# Node ID b42c2264048f8859c8966577a1929aa80132ffa5
# Parent  5644f7c8982e805e53f56fcbfe0322e9de58a934
blackbox: add configitem for format of log timestamps

Sometimes blackbox logs are used to report performance problems, but the
timestamps are only at second granularity, so often the timings have to
stated separately by the reporter. This is inconvenient and error-prone,
so I would like to include %f in the date format. This patch makes that
possible.

diff --git a/hgext/blackbox.py b/hgext/blackbox.py
--- a/hgext/blackbox.py
+++ b/hgext/blackbox.py
@@ -33,6 +33,11 @@ Examples::
   # rotate up to N log files when the current one gets too big
   maxfiles = 3

+  [blackbox]
+  # Include nanoseconds in log entries with %f (see Python function
+  # datetime.datetime.strftime)
+  date-format = '%Y-%m-%d @ %H:%M:%S.%f'
+
 """

 from __future__ import absolute_import
@@ -82,6 +87,9 @@ configitem('blackbox', 'maxfiles',
 configitem('blackbox', 'track',
 default=lambda: ['*'],
 )
+configitem('blackbox', 'date-format',
+default='%Y/%m/%d %H:%M:%S',
+)

 lastui = None

@@ -169,7 +177,9 @@ def wrapui(ui):
 return
 ui._bbinlog = True
 default = self.configdate('devel', 'default-date')
-date = dateutil.datestr(default, '%Y/%m/%d %H:%M:%S')
+format = ui.config('blackbox', 'date-format')
+date = dateutil.datestr(default,
+ui.config('blackbox', 'date-format'))
 user = procutil.getuser()
 pid = '%d' % procutil.getpid()
 formattedmsg = msg[0] % msg[1:]
diff --git a/tests/test-blackbox.t b/tests/test-blackbox.t
--- a/tests/test-blackbox.t
+++ b/tests/test-blackbox.t
@@ -82,6 +82,16 @@ recursive aliases work correctly
   1970/01/01 00:00:00 bob @ (5000)> 
so-confusing exited 0 after * seconds (glob)
   1970/01/01 00:00:00 bob @ (5000)> 
blackbox

+custom date format
+  $ rm ./.hg/blackbox.log
+  $ hg --config blackbox.date-format='%Y-%m-%d @ %H:%M:%S' \
+  >--config devel.default-date='1334347993 0' --traceback status
+  A a
+  $ hg blackbox
+  2012-04-13 @ 20:13:13 bob @ (5000)> 
--config 'blackbox.date-format=%Y-%m-%d @ %H:%M:%S' --config 
'devel.default-date=1334347993 0' --traceback status
+  2012-04-13 @ 20:13:13 bob @ (5000)> 
--config 'blackbox.date-format=%Y-%m-%d @ %H:%M:%S' --config 
'devel.default-date=1334347993 0' --traceback status exited 0 after * seconds 
(glob)
+  1970/01/01 00:00:00 bob @ (5000)> 
blackbox
+
 incoming change tracking

 create two heads to verify that we only see one change in the log later
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH] blackbox: add configitem for format of log timestamps

2018-10-23 Thread Yuya Nishihara
On Wed, 17 Oct 2018 16:34:53 -0700 (PDT), Matthew DeVore wrote:
> # HG changeset patch
> # User Matt DeVore 
> # Date 1539816481 25200
> #  Wed Oct 17 15:48:01 2018 -0700
> # Node ID b42c2264048f8859c8966577a1929aa80132ffa5
> # Parent  5644f7c8982e805e53f56fcbfe0322e9de58a934
> blackbox: add configitem for format of log timestamps

Looks good, but couldn't apply. Can you rebase onto the current tip?
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH] blackbox: add configitem for format of log timestamps

2018-10-23 Thread Matthew DeVore

Below is the updated patch, but only the Node ID and Parent have changed.
The context lines haven't changed.

Thank you for the review!

- Matt



# HG changeset patch
# User Matt DeVore 
# Date 1539816481 25200
#  Wed Oct 17 15:48:01 2018 -0700
# Node ID 2e598639da17601b731454614ecba2c13f6b91a9
# Parent  dce0e0f78f0f10578a17b586fe061e1985dd5c5f
blackbox: add configitem for format of log timestamps

Sometimes blackbox logs are used to report performance problems, but the
timestamps are only at second granularity, so often the timings have to
stated separately by the reporter. This is inconvenient and error-prone,
so I would like to include %f in the date format. This patch makes that
possible.

diff --git a/hgext/blackbox.py b/hgext/blackbox.py
--- a/hgext/blackbox.py
+++ b/hgext/blackbox.py
@@ -33,6 +33,11 @@ Examples::
   # rotate up to N log files when the current one gets too big
   maxfiles = 3

+  [blackbox]
+  # Include nanoseconds in log entries with %f (see Python function
+  # datetime.datetime.strftime)
+  date-format = '%Y-%m-%d @ %H:%M:%S.%f'
+
 """

 from __future__ import absolute_import
@@ -82,6 +87,9 @@ configitem('blackbox', 'maxfiles',
 configitem('blackbox', 'track',
 default=lambda: ['*'],
 )
+configitem('blackbox', 'date-format',
+default='%Y/%m/%d %H:%M:%S',
+)

 lastui = None

@@ -169,7 +177,9 @@ def wrapui(ui):
 return
 ui._bbinlog = True
 default = self.configdate('devel', 'default-date')
-date = dateutil.datestr(default, '%Y/%m/%d %H:%M:%S')
+format = ui.config('blackbox', 'date-format')
+date = dateutil.datestr(default,
+ui.config('blackbox', 'date-format'))
 user = procutil.getuser()
 pid = '%d' % procutil.getpid()
 formattedmsg = msg[0] % msg[1:]
diff --git a/tests/test-blackbox.t b/tests/test-blackbox.t
--- a/tests/test-blackbox.t
+++ b/tests/test-blackbox.t
@@ -82,6 +82,16 @@ recursive aliases work correctly
   1970/01/01 00:00:00 bob @ (5000)> 
so-confusing exited 0 after * seconds (glob)
   1970/01/01 00:00:00 bob @ (5000)> 
blackbox

+custom date format
+  $ rm ./.hg/blackbox.log
+  $ hg --config blackbox.date-format='%Y-%m-%d @ %H:%M:%S' \
+  >--config devel.default-date='1334347993 0' --traceback status
+  A a
+  $ hg blackbox
+  2012-04-13 @ 20:13:13 bob @ (5000)> 
--config 'blackbox.date-format=%Y-%m-%d @ %H:%M:%S' --config 
'devel.default-date=1334347993 0' --traceback status
+  2012-04-13 @ 20:13:13 bob @ (5000)> 
--config 'blackbox.date-format=%Y-%m-%d @ %H:%M:%S' --config 
'devel.default-date=1334347993 0' --traceback status exited 0 after * seconds 
(glob)
+  1970/01/01 00:00:00 bob @ (5000)> 
blackbox
+
 incoming change tracking

 create two heads to verify that we only see one change in the log later


___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH] blackbox: add configitem for format of log timestamps

2018-10-23 Thread Matthew DeVore via Mercurial-devel
From: Matt DeVore 

My e-mail client was mangling spaces, which is why you couldn't apply the
patch earlier. I'm sending this again with a different tool and e-mail address.


# HG changeset patch
# User Matt DeVore 
# Date 1539816481 25200
#  Wed Oct 17 15:48:01 2018 -0700
# Node ID 13c2fe6d3b30a743daa1984404a70ed769779d11
# Parent  a0e7fa019290d5348c4a83f6b287f2612d645025
blackbox: add configitem for format of log timestamps

Sometimes blackbox logs are used to report performance problems, but the
timestamps are only at second granularity, so often the timings have to
stated separately by the reporter. This is inconvenient and error-prone,
so I would like to include %f in the date format. This patch makes that
possible.

diff --git a/hgext/blackbox.py b/hgext/blackbox.py
--- a/hgext/blackbox.py
+++ b/hgext/blackbox.py
@@ -33,6 +33,11 @@ Examples::
   # rotate up to N log files when the current one gets too big
   maxfiles = 3
 
+  [blackbox]
+  # Include nanoseconds in log entries with %f (see Python function
+  # datetime.datetime.strftime)
+  date-format = '%Y-%m-%d @ %H:%M:%S.%f'
+
 """
 
 from __future__ import absolute_import
@@ -82,6 +87,9 @@ configitem('blackbox', 'maxfiles',
 configitem('blackbox', 'track',
 default=lambda: ['*'],
 )
+configitem('blackbox', 'date-format',
+default='%Y/%m/%d %H:%M:%S',
+)
 
 lastui = None
 
@@ -169,7 +177,9 @@ def wrapui(ui):
 return
 ui._bbinlog = True
 default = self.configdate('devel', 'default-date')
-date = dateutil.datestr(default, '%Y/%m/%d %H:%M:%S')
+format = ui.config('blackbox', 'date-format')
+date = dateutil.datestr(default,
+ui.config('blackbox', 'date-format'))
 user = procutil.getuser()
 pid = '%d' % procutil.getpid()
 formattedmsg = msg[0] % msg[1:]
diff --git a/tests/test-blackbox.t b/tests/test-blackbox.t
--- a/tests/test-blackbox.t
+++ b/tests/test-blackbox.t
@@ -82,6 +82,16 @@ recursive aliases work correctly
   1970/01/01 00:00:00 bob @ (5000)> 
so-confusing exited 0 after * seconds (glob)
   1970/01/01 00:00:00 bob @ (5000)> 
blackbox
 
+custom date format
+  $ rm ./.hg/blackbox.log
+  $ hg --config blackbox.date-format='%Y-%m-%d @ %H:%M:%S' \
+  >--config devel.default-date='1334347993 0' --traceback status
+  A a
+  $ hg blackbox
+  2012-04-13 @ 20:13:13 bob @ (5000)> 
--config 'blackbox.date-format=%Y-%m-%d @ %H:%M:%S' --config 
'devel.default-date=1334347993 0' --traceback status
+  2012-04-13 @ 20:13:13 bob @ (5000)> 
--config 'blackbox.date-format=%Y-%m-%d @ %H:%M:%S' --config 
'devel.default-date=1334347993 0' --traceback status exited 0 after * seconds 
(glob)
+  1970/01/01 00:00:00 bob @ (5000)> 
blackbox
+
 incoming change tracking
 
 create two heads to verify that we only see one change in the log later


___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH] blackbox: add configitem for format of log timestamps

2018-10-24 Thread Yuya Nishihara
On Tue, 23 Oct 2018 13:49:41 -0700, Matthew DeVore wrote:
> From: Matt DeVore 
> 
> My e-mail client was mangling spaces, which is why you couldn't apply the
> patch earlier. I'm sending this again with a different tool and e-mail 
> address.
> 
> 
> # HG changeset patch
> # User Matt DeVore 
> # Date 1539816481 25200
> #  Wed Oct 17 15:48:01 2018 -0700
> # Node ID 13c2fe6d3b30a743daa1984404a70ed769779d11
> # Parent  a0e7fa019290d5348c4a83f6b287f2612d645025
> blackbox: add configitem for format of log timestamps

Queued, thanks.

You can use Phabricator to submit patches. I don't like it, but it'll be
a better option if your email environment is restricted.

https://www.mercurial-scm.org/wiki/ContributingChanges#Sending_patches

> @@ -169,7 +177,9 @@ def wrapui(ui):
>  return
>  ui._bbinlog = True
>  default = self.configdate('devel', 'default-date')
> -date = dateutil.datestr(default, '%Y/%m/%d %H:%M:%S')
> +format = ui.config('blackbox', 'date-format')

Removed unused variable.

> +date = dateutil.datestr(default,
> +ui.config('blackbox', 'date-format'))
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH] blackbox: add configitem for format of log timestamps

2018-11-21 Thread MATTHEW DEVORE
Ping. Did you have any trouble applying this updated patch? This one should not 
have any mangled spaces.
> On October 23, 2018 at 1:49 PM Matthew DeVore wrote:
>
>
> From: Matt DeVore
>
> My e-mail client was mangling spaces, which is why you couldn't apply the
> patch earlier. I'm sending this again with a different tool and e-mail 
> address.
> 
>
> # HG changeset patch
> # User Matt DeVore
> # Date 1539816481 25200
> # Wed Oct 17 15:48:01 2018 -0700
> # Node ID 13c2fe6d3b30a743daa1984404a70ed769779d11
> # Parent a0e7fa019290d5348c4a83f6b287f2612d645025
> blackbox: add configitem for format of log timestamps
>
> Sometimes blackbox logs are used to report performance problems, but the
> timestamps are only at second granularity, so often the timings have to
> stated separately by the reporter. This is inconvenient and error-prone,
> so I would like to include %f in the date format. This patch makes that
> possible.
>
> diff --git a/hgext/blackbox.py b/hgext/blackbox.py
> --- a/hgext/blackbox.py
> +++ b/hgext/blackbox.py
> @@ -33,6 +33,11 @@ Examples::
> # rotate up to N log files when the current one gets too big
> maxfiles = 3
>
> + [blackbox]
> + # Include nanoseconds in log entries with %f (see Python function
> + # datetime.datetime.strftime)
> + date-format = '%Y-%m-%d @ %H:%M:%S.%f'
> +
> """
>
> from __future__ import absolute_import
> @@ -82,6 +87,9 @@ configitem('blackbox', 'maxfiles',
> configitem('blackbox', 'track',
> default=lambda: ['*'],
> )
> +configitem('blackbox', 'date-format',
> + default='%Y/%m/%d %H:%M:%S',
> +)
>
> lastui = None
>
> @@ -169,7 +177,9 @@ def wrapui(ui):
> return
> ui._bbinlog = True
> default = self.configdate('devel', 'default-date')
> - date = dateutil.datestr(default, '%Y/%m/%d %H:%M:%S')
> + format = ui.config('blackbox', 'date-format')
> + date = dateutil.datestr(default,
> + ui.config('blackbox', 'date-format'))
> user = procutil.getuser()
> pid = '%d' % procutil.getpid()
> formattedmsg = msg[0] % msg[1:]
> diff --git a/tests/test-blackbox.t b/tests/test-blackbox.t
> --- a/tests/test-blackbox.t
> +++ b/tests/test-blackbox.t
> @@ -82,6 +82,16 @@ recursive aliases work correctly
> 1970/01/01 00:00:00 bob @ (5000)> 
> so-confusing exited 0 after * seconds (glob)
> 1970/01/01 00:00:00 bob @ (5000)> 
> blackbox
>
> +custom date format
> + $ rm ./.hg/blackbox.log
> + $ hg --config blackbox.date-format='%Y-%m-%d @ %H:%M:%S' \
> + > --config devel.default-date='1334347993 0' --traceback status
> + A a
> + $ hg blackbox
> + 2012-04-13 @ 20:13:13 bob @ (5000)> 
> --config 'blackbox.date-format=%Y-%m-%d @ %H:%M:%S' --config 
> 'devel.default-date=1334347993 0' --traceback status
> + 2012-04-13 @ 20:13:13 bob @ (5000)> 
> --config 'blackbox.date-format=%Y-%m-%d @ %H:%M:%S' --config 
> 'devel.default-date=1334347993 0' --traceback status exited 0 after * seconds 
> (glob)
> + 1970/01/01 00:00:00 bob @ (5000)> 
> blackbox
> +
> incoming change tracking
>
> create two heads to verify that we only see one change in the log later
>
>___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH] blackbox: add configitem for format of log timestamps

2018-11-21 Thread Martin von Zweigbergk via Mercurial-devel
On Wed, Nov 21, 2018 at 8:32 AM MATTHEW DEVORE  wrote:

> Ping. Did you have any trouble applying this updated patch? This one
> should not have any mangled spaces.
>

This was queued as https://www.mercurial-scm.org/repo/hg/rev/25f1c7bd649d
(Yuya replied to you at Oct 24, 2018, 4:15 AM Pacific time).


> > On October 23, 2018 at 1:49 PM Matthew DeVore wrote:
> >
> >
> > From: Matt DeVore
> >
> > My e-mail client was mangling spaces, which is why you couldn't apply
> the
> > patch earlier. I'm sending this again with a different tool and e-mail
> address.
> >
> 
>
> >
> > # HG changeset patch
> > # User Matt DeVore
> > # Date 1539816481 25200
> > # Wed Oct 17 15:48:01 2018 -0700
> > # Node ID 13c2fe6d3b30a743daa1984404a70ed769779d11
> > # Parent a0e7fa019290d5348c4a83f6b287f2612d645025
> > blackbox: add configitem for format of log timestamps
> >
> > Sometimes blackbox logs are used to report performance problems, but the
> > timestamps are only at second granularity, so often the timings have to
> > stated separately by the reporter. This is inconvenient and error-prone,
> > so I would like to include %f in the date format. This patch makes that
> > possible.
> >
> > diff --git a/hgext/blackbox.py b/hgext/blackbox.py
> > --- a/hgext/blackbox.py
> > +++ b/hgext/blackbox.py
> > @@ -33,6 +33,11 @@ Examples::
> > # rotate up to N log files when the current one gets too big
> > maxfiles = 3
> >
> > + [blackbox]
> > + # Include nanoseconds in log entries with %f (see Python function
> > + # datetime.datetime.strftime)
> > + date-format = '%Y-%m-%d @ %H:%M:%S.%f'
> > +
> > """
> >
> > from __future__ import absolute_import
> > @@ -82,6 +87,9 @@ configitem('blackbox', 'maxfiles',
> > configitem('blackbox', 'track',
> > default=lambda: ['*'],
> > )
> > +configitem('blackbox', 'date-format',
> > + default='%Y/%m/%d %H:%M:%S',
> > +)
> >
> > lastui = None
> >
> > @@ -169,7 +177,9 @@ def wrapui(ui):
> > return
> > ui._bbinlog = True
> > default = self.configdate('devel', 'default-date')
> > - date = dateutil.datestr(default, '%Y/%m/%d %H:%M:%S')
> > + format = ui.config('blackbox', 'date-format')
> > + date = dateutil.datestr(default,
> > + ui.config('blackbox', 'date-format'))
> > user = procutil.getuser()
> > pid = '%d' % procutil.getpid()
> > formattedmsg = msg[0] % msg[1:]
> > diff --git a/tests/test-blackbox.t b/tests/test-blackbox.t
> > --- a/tests/test-blackbox.t
> > +++ b/tests/test-blackbox.t
> > @@ -82,6 +82,16 @@ recursive aliases work correctly
> > 1970/01/01 00:00:00 bob @
> (5000)> so-confusing exited 0 after * seconds (glob)
> > 1970/01/01 00:00:00 bob @
> (5000)> blackbox
> >
> > +custom date format
> > + $ rm ./.hg/blackbox.log
> > + $ hg --config blackbox.date-format='%Y-%m-%d @ %H:%M:%S' \
> > + > --config devel.default-date='1334347993 0' --traceback status
> > + A a
> > + $ hg blackbox
> > + 2012-04-13 @ 20:13:13 bob @
> (5000)> --config 'blackbox.date-format=%Y-%m-%d @ %H:%M:%S' --config
> 'devel.default-date=1334347993 0' --traceback status
> > + 2012-04-13 @ 20:13:13 bob @
> (5000)> --config 'blackbox.date-format=%Y-%m-%d @ %H:%M:%S' --config
> 'devel.default-date=1334347993 0' --traceback status exited 0 after *
> seconds (glob)
> > + 1970/01/01 00:00:00 bob @
> (5000)> blackbox
> > +
> > incoming change tracking
> >
> > create two heads to verify that we only see one change in the log later
> >
> >
> ___
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
>
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH] blackbox: add configitem for format of log timestamps

2018-11-21 Thread Pulkit Goyal
On Wed, Nov 21, 2018 at 7:32 PM MATTHEW DEVORE  wrote:

> Ping. Did you have any trouble applying this updated patch? This one
> should not have any mangled spaces.
>

Your patch is already pushed.
https://www.mercurial-scm.org/repo/hg/rev/25f1c7bd649d
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH] blackbox: add configitem for format of log timestamps

2018-11-21 Thread Matthew DeVore via Mercurial-devel
I see now Yuya told me the change was queued in a prior e-mail. This
thread is actually a nexus of 5 or 6 e-mail screw-ups on my part, so I
didn't see it.

Thank you all for helping me and I'll try Phabricator next time :)
On Wed, Nov 21, 2018 at 8:37 AM Pulkit Goyal <7895pul...@gmail.com> wrote:
>
>
>
> On Wed, Nov 21, 2018 at 7:32 PM MATTHEW DEVORE  wrote:
>>
>> Ping. Did you have any trouble applying this updated patch? This one should 
>> not have any mangled spaces.
>
>
> Your patch is already pushed. 
> https://www.mercurial-scm.org/repo/hg/rev/25f1c7bd649d
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel