# HG changeset patch # User Vadim Gelfer # Date 1141420285 28800 # Node ID 7a58bf789965fb97e8a712913521318ffb16559b # Parent bf118f39afd74f8f97483fa4c9c9c871a9340cc9 generate profile even when exception raised. otherwise, is not possible to profile hg serve. diff -r bf118f39afd7 -r 7a58bf789965 mercurial/commands.py --- a/mercurial/commands.py Fri Mar 03 09:40:18 2006 -0800 +++ b/mercurial/commands.py Fri Mar 03 13:11:25 2006 -0800 @@ -2862,13 +2862,21 @@ if options['profile']: import hotshot, hotshot.stats prof = hotshot.Profile("hg.prof") - r = prof.runcall(d) - prof.close() - stats = hotshot.stats.load("hg.prof") - stats.strip_dirs() - stats.sort_stats('time', 'calls') - stats.print_stats(40) - return r + try: + try: + return prof.runcall(d) + except: + try: + u.warn(_('exception raised - generating profile ' + 'anyway\n')) + except: + pass + finally: + prof.close() + stats = hotshot.stats.load("hg.prof") + stats.strip_dirs() + stats.sort_stats('time', 'calls') + stats.print_stats(40) else: return d() except: