comparison mercurial/commands.py @ 1837:6f67a4c93493

make ui flush output. this makes error happen if printing to /dev/full. before this change, error happened with some pythons, but not others. now always happens. fixes issue 155.
author Vadim Gelfer <vadim.gelfer@gmail.com>
date Mon, 06 Mar 2006 08:35:15 -0800
parents bdfb524d728a
children d17f19d84fd3
comparison
equal deleted inserted replaced
1836:cd5c1db2132a 1837:6f67a4c93493
2858 x.reposetup(u, repo) 2858 x.reposetup(u, repo)
2859 d = lambda: func(u, repo, *args, **cmdoptions) 2859 d = lambda: func(u, repo, *args, **cmdoptions)
2860 else: 2860 else:
2861 d = lambda: func(u, *args, **cmdoptions) 2861 d = lambda: func(u, *args, **cmdoptions)
2862 2862
2863 if options['profile']: 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 pass 2871 try:
2875 raise 2872 u.warn(_('exception raised - generating '
2876 finally: 2873 'profile anyway\n'))
2877 prof.close() 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 stats.print_stats(40) 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']:
2887 pdb.post_mortem(sys.exc_info()[2]) 2890 pdb.post_mortem(sys.exc_info()[2])
2888 if options['traceback']: 2891 if options['traceback']: