Show More
@@ -2860,27 +2860,30 b' def dispatch(args):' | |||||
2860 | else: |
|
2860 | else: | |
2861 | d = lambda: func(u, *args, **cmdoptions) |
|
2861 | d = lambda: func(u, *args, **cmdoptions) | |
2862 |
|
2862 | |||
2863 |
|
|
2863 | try: | |
2864 | import hotshot, hotshot.stats |
|
2864 | if options['profile']: | |
2865 | prof = hotshot.Profile("hg.prof") |
|
2865 | import hotshot, hotshot.stats | |
2866 | try: |
|
2866 | prof = hotshot.Profile("hg.prof") | |
2867 | try: |
|
2867 | try: | |
2868 | return prof.runcall(d) |
|
|||
2869 | except: |
|
|||
2870 | try: |
|
2868 | try: | |
2871 | u.warn(_('exception raised - generating profile ' |
|
2869 | return prof.runcall(d) | |
2872 | 'anyway\n')) |
|
|||
2873 | except: |
|
2870 | except: | |
2874 |
|
|
2871 | try: | |
2875 | raise |
|
2872 | u.warn(_('exception raised - generating ' | |
2876 | finally: |
|
2873 | 'profile anyway\n')) | |
2877 |
|
|
2874 | except: | |
2878 | stats = hotshot.stats.load("hg.prof") |
|
2875 | pass | |
2879 | stats.strip_dirs() |
|
2876 | raise | |
2880 | stats.sort_stats('time', 'calls') |
|
2877 | finally: | |
2881 |
|
|
2878 | prof.close() | |
2882 | else: |
|
2879 | stats = hotshot.stats.load("hg.prof") | |
2883 | return d() |
|
2880 | stats.strip_dirs() | |
|
2881 | stats.sort_stats('time', 'calls') | |||
|
2882 | stats.print_stats(40) | |||
|
2883 | else: | |||
|
2884 | return d() | |||
|
2885 | finally: | |||
|
2886 | u.flush() | |||
2884 | except: |
|
2887 | except: | |
2885 | # enter the debugger when we hit an exception |
|
2888 | # enter the debugger when we hit an exception | |
2886 | if options['debugger']: |
|
2889 | if options['debugger']: |
@@ -132,6 +132,12 b' class ui(object):' | |||||
132 | for a in args: |
|
132 | for a in args: | |
133 | sys.stderr.write(str(a)) |
|
133 | sys.stderr.write(str(a)) | |
134 |
|
134 | |||
|
135 | def flush(self): | |||
|
136 | try: | |||
|
137 | sys.stdout.flush() | |||
|
138 | finally: | |||
|
139 | sys.stderr.flush() | |||
|
140 | ||||
135 | def readline(self): |
|
141 | def readline(self): | |
136 | return sys.stdin.readline()[:-1] |
|
142 | return sys.stdin.readline()[:-1] | |
137 | def prompt(self, msg, pat, default="y"): |
|
143 | def prompt(self, msg, pat, default="y"): |
General Comments 0
You need to be logged in to leave comments.
Login now