statprof: require input file
statprof has a __main__ handler that allows viewing of previously
written data files. As Yuya pointed out during review,
f42cd5434cc2
broke this. This patch fixes that.
--- a/mercurial/statprof.py Wed Jan 18 23:43:41 2017 -0500
+++ b/mercurial/statprof.py Wed Jan 18 22:45:07 2017 -0800
@@ -800,6 +800,10 @@
else:
assert False, "unhandled option %s" % o
+ if not path:
+ print('must specify --file to load')
+ return 1
+
load_data(path=path)
display(**displayargs)
--- a/tests/test-profile.t Wed Jan 18 23:43:41 2017 -0500
+++ b/tests/test-profile.t Wed Jan 18 22:45:07 2017 -0800
@@ -92,4 +92,10 @@
$ cat ../out
\[\[\d+.* (re)
+statprof can be used as a standalone module
+
+ $ $PYTHON -m mercurial.statprof hotpath
+ must specify --file to load
+ [1]
+
$ cd ..