From 9c03a7696d3602d405d5176c3bf53b9aef8a3d6c Mon Sep 17 00:00:00 2001 From: Gregory Szorc Date: Wed, 18 Jan 2017 22:45:07 -0800 Subject: [PATCH] statprof: require input file statprof has a __main__ handler that allows viewing of previously written data files. As Yuya pointed out during review, 82ee01726a77 broke this. This patch fixes that. --- mercurial/statprof.py | 4 ++++ tests/test-profile.t | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/mercurial/statprof.py b/mercurial/statprof.py index 8f5da57390..71aa1de17f 100755 --- a/mercurial/statprof.py +++ b/mercurial/statprof.py @@ -800,6 +800,10 @@ def main(argv=None): else: assert False, "unhandled option %s" % o + if not path: + print('must specify --file to load') + return 1 + load_data(path=path) display(**displayargs) diff --git a/tests/test-profile.t b/tests/test-profile.t index dbcb595179..8d59cb9fa6 100644 --- a/tests/test-profile.t +++ b/tests/test-profile.t @@ -92,4 +92,10 @@ Various statprof formatters work $ cat ../out \[\[\d+.* (re) +statprof can be used as a standalone module + + $ $PYTHON -m mercurial.statprof hotpath + must specify --file to load + [1] + $ cd ..