statprof: require input file stable
authorGregory Szorc <gregory.szorc@gmail.com>
Wed, 18 Jan 2017 22:45:07 -0800
branchstable
changeset 30845 262c2be8ea5a
parent 30844 b3d2e8cce78c
child 30846 dfc6663f97ca
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.
mercurial/statprof.py
tests/test-profile.t
--- 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 ..