##// END OF EJS Templates
[PATCH] Add --traceback option...
mpm@selenic.com -
r527:58790c83 default
parent child Browse files
Show More
@@ -818,6 +818,7 b' def dispatch(args):'
818 818 ('q', 'quiet', None, 'quiet'),
819 819 ('p', 'profile', None, 'profile'),
820 820 ('R', 'repository', "", 'repository root directory'),
821 ('', 'traceback', None, 'print traceback on exception'),
821 822 ('y', 'noninteractive', None, 'run non-interactively'),
822 823 ('', 'version', None, 'output version information and exit'),
823 824 ]
@@ -855,25 +856,30 b' def dispatch(args):'
855 856 sys.exit(-1)
856 857
857 858 try:
858 if cmd not in norepo.split():
859 path = options["repository"] or ""
860 repo = hg.repository(ui=u, path=path)
861 d = lambda: i[0](u, repo, *args, **cmdoptions)
862 else:
863 d = lambda: i[0](u, *args, **cmdoptions)
859 try:
860 if cmd not in norepo.split():
861 path = options["repository"] or ""
862 repo = hg.repository(ui=u, path=path)
863 d = lambda: i[0](u, repo, *args, **cmdoptions)
864 else:
865 d = lambda: i[0](u, *args, **cmdoptions)
864 866
865 if options['profile']:
866 import hotshot, hotshot.stats
867 prof = hotshot.Profile("hg.prof")
868 r = prof.runcall(d)
869 prof.close()
870 stats = hotshot.stats.load("hg.prof")
871 stats.strip_dirs()
872 stats.sort_stats('time', 'calls')
873 stats.print_stats(40)
874 return r
875 else:
876 return d()
867 if options['profile']:
868 import hotshot, hotshot.stats
869 prof = hotshot.Profile("hg.prof")
870 r = prof.runcall(d)
871 prof.close()
872 stats = hotshot.stats.load("hg.prof")
873 stats.strip_dirs()
874 stats.sort_stats('time', 'calls')
875 stats.print_stats(40)
876 return r
877 else:
878 return d()
879 except:
880 if options['traceback']:
881 traceback.print_exc()
882 raise
877 883 except util.CommandError, inst:
878 884 u.warn("abort: %s\n" % inst.args)
879 885 except hg.RepoError, inst:
General Comments 0
You need to be logged in to leave comments. Login now