changeset 30845:262c2be8ea5a stable

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.
author Gregory Szorc <gregory.szorc@gmail.com>
date Wed, 18 Jan 2017 22:45:07 -0800
parents b3d2e8cce78c
children dfc6663f97ca
files mercurial/statprof.py tests/test-profile.t
diffstat 2 files changed, 10 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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 ..