Patchwork contrib: update window title when possible in perf-revlog-write-plot.py

login
register
mail settings
Submitter Boris Feld
Date Jan. 11, 2019, 10:57 a.m.
Message ID <a155939fbbe9e587b80e.1547204256@Laptop-Boris.lan>
Download mbox | patch
Permalink /patch/37657/
State Accepted
Headers show

Comments

Boris Feld - Jan. 11, 2019, 10:57 a.m.
# HG changeset patch
# User Boris Feld <boris.feld@octobus.net>
# Date 1546550008 -3600
#      Thu Jan 03 22:13:28 2019 +0100
# Node ID a155939fbbe9e587b80e5a1a3856903efbb6b6ad
# Parent  963462786f6e028563bcedc9008622e0f3b59c86
# EXP-Topic sparse-plot
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r a155939fbbe9
contrib: update window title when possible in perf-revlog-write-plot.py

This is useful when comparing multiple graphs.
Yuya Nishihara - Jan. 12, 2019, 2:11 a.m.
On Fri, 11 Jan 2019 11:57:36 +0100, Boris Feld wrote:
> # HG changeset patch
> # User Boris Feld <boris.feld@octobus.net>
> # Date 1546550008 -3600
> #      Thu Jan 03 22:13:28 2019 +0100
> # Node ID a155939fbbe9e587b80e5a1a3856903efbb6b6ad
> # Parent  963462786f6e028563bcedc9008622e0f3b59c86
> # EXP-Topic sparse-plot
> # Available At https://bitbucket.org/octobus/mercurial-devel/
> #              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r a155939fbbe9
> contrib: update window title when possible in perf-revlog-write-plot.py

Queued, thanks.

> --- a/tests/hghave.py
> +++ b/tests/hghave.py
> @@ -127,6 +127,7 @@ def matchoutput(cmd, regexp, ignorestatu
>          ret = -1
>      s = p.communicate()[0]
>      ret = p.returncode
> +    print("S", s, ret)

Dropped this change.

Patch

diff --git a/contrib/perf-utils/perf-revlog-write-plot.py b/contrib/perf-utils/perf-revlog-write-plot.py
--- a/contrib/perf-utils/perf-revlog-write-plot.py
+++ b/contrib/perf-utils/perf-revlog-write-plot.py
@@ -22,7 +22,7 @@  from matplotlib import (
 )
 
 
-def plot(data):
+def plot(data, title=None):
     items = {}
     re_title = re.compile(r'^revisions #\d+ of \d+, rev (\d+)$')
     for item in data:
@@ -108,6 +108,8 @@  def plot(data):
         else:
             legline.set_alpha(0.2)
         fig.canvas.draw()
+    if title is not None:
+        fig.canvas.set_window_title(title)
     fig.canvas.mpl_connect('pick_event', onpick)
 
     plt.show()
@@ -119,7 +121,7 @@  if __name__ == '__main__':
     if len(sys.argv) > 1:
         print('reading from %r' % sys.argv[1])
         with open(sys.argv[1], 'r') as fp:
-            plot(json.load(fp))
+            plot(json.load(fp), title=sys.argv[1])
     else:
         print('reading from stdin')
         plot(json.load(sys.stdin))
diff --git a/tests/hghave.py b/tests/hghave.py
--- a/tests/hghave.py
+++ b/tests/hghave.py
@@ -127,6 +127,7 @@  def matchoutput(cmd, regexp, ignorestatu
         ret = -1
     s = p.communicate()[0]
     ret = p.returncode
+    print("S", s, ret)
     return (ignorestatus or not ret) and r.search(s)
 
 @check("baz", "GNU Arch baz client")