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