mercurial/commands.py
changeset 499 81c563a254be
parent 496 6ce95a04999d
child 500 ebc4714a7632
equal deleted inserted replaced
498:8cf3999b3d03 499:81c563a254be
   849     except fancyopts.getopt.GetoptError, inst:
   849     except fancyopts.getopt.GetoptError, inst:
   850         u.warn("hg %s: %s\n" % (cmd, inst))
   850         u.warn("hg %s: %s\n" % (cmd, inst))
   851         help(u, cmd)
   851         help(u, cmd)
   852         sys.exit(-1)
   852         sys.exit(-1)
   853 
   853 
   854     if cmd not in norepo.split():
       
   855         repo = hg.repository(ui = u)
       
   856         d = lambda: i[0](u, repo, *args, **cmdoptions)
       
   857     else:
       
   858         d = lambda: i[0](u, *args, **cmdoptions)
       
   859 
       
   860     try:
   854     try:
       
   855         if cmd not in norepo.split():
       
   856             repo = hg.repository(ui = u)
       
   857             d = lambda: i[0](u, repo, *args, **cmdoptions)
       
   858         else:
       
   859             d = lambda: i[0](u, *args, **cmdoptions)
       
   860 
   861         if options['profile']:
   861         if options['profile']:
   862             import hotshot, hotshot.stats
   862             import hotshot, hotshot.stats
   863             prof = hotshot.Profile("hg.prof")
   863             prof = hotshot.Profile("hg.prof")
   864             r = prof.runcall(d)
   864             r = prof.runcall(d)
   865             prof.close()
   865             prof.close()
   868             stats.sort_stats('time', 'calls')
   868             stats.sort_stats('time', 'calls')
   869             stats.print_stats(40)
   869             stats.print_stats(40)
   870             return r
   870             return r
   871         else:
   871         else:
   872             return d()
   872             return d()
       
   873     except hg.RepoError, inst:
       
   874         u.warn("abort: ", inst, "!\n")
   873     except SignalInterrupt:
   875     except SignalInterrupt:
   874         u.warn("killed!\n")
   876         u.warn("killed!\n")
   875     except KeyboardInterrupt:
   877     except KeyboardInterrupt:
   876         u.warn("interrupted!\n")
   878         u.warn("interrupted!\n")
   877     except IOError, inst:
   879     except IOError, inst: