# HG changeset patch # User Gregory Szorc # Date 1478316157 25200 # Node ID 1e53463139637776e6dacc0177162da5e9b9168e # Parent d4db88a26ad53e20d1183581d1c73b82b0e96686 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 -r d4db88a26ad5 -r 1e5346313963 mercurial/statprof.py --- a/mercurial/statprof.py Sat Nov 05 13:20:53 2016 +0900 +++ b/mercurial/statprof.py Fri Nov 04 20:22:37 2016 -0700 @@ -324,6 +324,8 @@ if statprofpath: save_data(statprofpath) + return state + def save_data(path): with open(path, 'w+') as file: file.write(str(state.accumulated_time) + '\n')