changeset 8021:1c2cf2e5dc9b

profiling: dropping hotshot profiling. --profile as a unique profiling option hotshot was an experimental module, which is broken for Python < 2.5 And even for Python >= 2.5 users, hotshot usage is discouraged: cProfile (formerly lsprof) should be used instead.
author Nicolas Dumazet <nicdumz.commits@gmail.com>
date Wed, 08 Apr 2009 14:18:20 +0200
parents 777a9efdae2d
children 4f3fdfaa3874
files mercurial/commands.py mercurial/dispatch.py tests/test-debugcomplete.out tests/test-extension.out tests/test-profile tests/test-profile.out
diffstat 6 files changed, 2 insertions(+), 32 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Tue Apr 07 20:57:25 2009 +0200
+++ b/mercurial/commands.py	Wed Apr 08 14:18:20 2009 +0200
@@ -3000,7 +3000,6 @@
     ('', 'encoding', encoding.encoding, _('set the charset encoding')),
     ('', 'encodingmode', encoding.encodingmode,
      _('set the charset encoding mode')),
-    ('', 'lsprof', None, _('print improved command execution profile')),
     ('', 'traceback', None, _('print traceback on exception')),
     ('', 'time', None, _('time how long the command takes')),
     ('', 'profile', None, _('print command execution profile')),
--- a/mercurial/dispatch.py	Tue Apr 07 20:57:25 2009 +0200
+++ b/mercurial/dispatch.py	Wed Apr 08 14:18:20 2009 +0200
@@ -379,25 +379,6 @@
             raise error.ParseError(cmd, _("invalid arguments"))
 
     if options['profile']:
-        import hotshot, hotshot.stats
-        prof = hotshot.Profile("hg.prof")
-        try:
-            try:
-                return prof.runcall(checkargs)
-            except:
-                try:
-                    ui.warn(_('exception raised - generating '
-                             'profile anyway\n'))
-                except:
-                    pass
-                raise
-        finally:
-            prof.close()
-            stats = hotshot.stats.load("hg.prof")
-            stats.strip_dirs()
-            stats.sort_stats('time', 'calls')
-            stats.print_stats(40)
-    elif options['lsprof']:
         try:
             from mercurial import lsprof
         except ImportError:
--- a/tests/test-debugcomplete.out	Tue Apr 07 20:57:25 2009 +0200
+++ b/tests/test-debugcomplete.out	Wed Apr 08 14:18:20 2009 +0200
@@ -97,7 +97,6 @@
 --encoding
 --encodingmode
 --help
---lsprof
 --noninteractive
 --profile
 --quiet
@@ -127,7 +126,6 @@
 --errorlog
 --help
 --ipv6
---lsprof
 --name
 --noninteractive
 --pid-file
--- a/tests/test-extension.out	Tue Apr 07 20:57:25 2009 +0200
+++ b/tests/test-extension.out	Wed Apr 08 14:18:20 2009 +0200
@@ -48,7 +48,6 @@
     --debugger        start debugger
     --encoding        set the charset encoding (default: ascii)
     --encodingmode    set the charset encoding mode (default: strict)
-    --lsprof          print improved command execution profile
     --traceback       print traceback on exception
     --time            time how long the command takes
     --profile         print command execution profile
--- a/tests/test-profile	Tue Apr 07 20:57:25 2009 +0200
+++ b/tests/test-profile	Wed Apr 08 14:18:20 2009 +0200
@@ -4,12 +4,6 @@
 hg --time help -q help 2>&1 | grep Time > /dev/null || echo --time failed
 
 echo % test --profile
-if "$TESTDIR/hghave" -q hotshot; then
-    # hotshot might be missing for licensing issues
-    hg --profile help -q help 2>&1 | grep ncalls > /dev/null || echo --profile failed
+if "$TESTDIR/hghave" -q lsprof; then
+    hg --profile help -q help 2>&1 | grep CallCount > /dev/null || echo --profile failed
 fi
-
-echo % test --lsprof
-if "$TESTDIR/hghave" -q lsprof; then
-    hg --lsprof help -q help 2>&1 | grep CallCount > /dev/null || echo --lsprof failed
-fi
--- a/tests/test-profile.out	Tue Apr 07 20:57:25 2009 +0200
+++ b/tests/test-profile.out	Wed Apr 08 14:18:20 2009 +0200
@@ -1,3 +1,2 @@
 % test --time
 % test --profile
-% test --lsprof