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