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