Re: [PATCH follow-up] statprof: fix save and load

2018-06-12 Thread Yuya Nishihara
On Tue, 12 Jun 2018 09:54:03 +0200, Boris Feld wrote:
> # HG changeset patch
> # User Boris Feld 
> # Date 1528737841 -7200
> #  Mon Jun 11 19:24:01 2018 +0200
> # Node ID 4e4c30424be81d5eb3748e4b031b61c7622341b6
> # Parent  15a1e37f80bd5af4b8eedd55b0c347c41a974839
> # EXP-Topic walltime-followup
> # Available At https://bitbucket.org/octobus/mercurial-devel/
> #  hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
> 4e4c30424be8
> statprof: fix save and load

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


[PATCH follow-up] statprof: fix save and load

2018-06-12 Thread Boris Feld
# HG changeset patch
# User Boris Feld 
# Date 1528737841 -7200
#  Mon Jun 11 19:24:01 2018 +0200
# Node ID 4e4c30424be81d5eb3748e4b031b61c7622341b6
# Parent  15a1e37f80bd5af4b8eedd55b0c347c41a974839
# EXP-Topic walltime-followup
# Available At https://bitbucket.org/octobus/mercurial-devel/
#  hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
4e4c30424be8
statprof: fix save and load

Fix these functions even if they don't are used at the moment. Thanks to Yuya
Nishihara for spotting that.

diff --git a/mercurial/statprof.py b/mercurial/statprof.py
--- a/mercurial/statprof.py
+++ b/mercurial/statprof.py
@@ -350,7 +350,7 @@ def stop():
 
 def save_data(path):
 with open(path, 'w+') as file:
-file.write(str(state.accumulated_time) + '\n')
+file.write("%f %f\n" % state.accumulated_time)
 for sample in state.samples:
 time = str(sample.time)
 stack = sample.stack
@@ -361,7 +361,7 @@ def save_data(path):
 def load_data(path):
 lines = open(path, 'r').read().splitlines()
 
-state.accumulated_time = float(lines[0])
+state.accumulated_time = [float(value) for value in lines[0].split()]
 state.samples = []
 for line in lines[1:]:
 parts = line.split('\0')
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel