[PATCH 1 of 4] statprof: return state from stop()

Gregory Szorc gregory.szorc at gmail.com
Sat Nov 5 04:53:40 UTC 2016


# HG changeset patch
# User Gregory Szorc <gregory.szorc at gmail.com>
# Date 1478316157 25200
#      Fri Nov 04 20:22:37 2016 -0700
# Node ID cffcf1865da6bdeb0a59de9ac00c563bbadf1a9b
# Parent  d06c049695e6ad3219e7479c65ce98a2f123e878
statprof: return state from stop()

I don't like global variables. Have stop() return the captured
state so callers can pass data to the display function.

diff --git a/mercurial/statprof.py b/mercurial/statprof.py
--- a/mercurial/statprof.py
+++ b/mercurial/statprof.py
@@ -324,6 +324,8 @@ def stop():
         if statprofpath:
             save_data(statprofpath)
 
+    return state
+
 def save_data(path):
     with open(path, 'w+') as file:
         file.write(str(state.accumulated_time) + '\n')


More information about the Mercurial-devel mailing list