~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/commands.py

  • Committer: Ross Lagerwall
  • Date: 2012-08-07 06:32:51 UTC
  • mto: (6437.63.5 2.5)
  • mto: This revision was merged to the branch mainline in revision 6558.
  • Revision ID: rosslagerwall@gmail.com-20120807063251-x9p03ghg2ws8oqjc
Add bzrlib/locale to .bzrignore

bzrlib/locale is generated with ./setup.py build_mo which is in turn called
by ./setup.py build

Show diffs side-by-side

added added

removed removed

Lines of Context:
690
690
        """
691
691
        class_run = self.run
692
692
        def run(*args, **kwargs):
693
 
            for hook in Command.hooks['pre_command']:
694
 
                hook(self)
695
693
            self._operation = cleanup.OperationWithCleanups(class_run)
696
694
            try:
697
695
                return self._operation.run_simple(*args, **kwargs)
698
696
            finally:
699
697
                del self._operation
700
 
                for hook in Command.hooks['post_command']:
701
 
                    hook(self)
702
698
        self.run = run
703
699
 
704
700
    def run(self):
792
788
            " is safe to mutate - e.g. to remove a command. "
793
789
            "list_commands should return the updated set of command names.",
794
790
            (1, 17))
795
 
        self.add_hook('pre_command',
796
 
            "Called prior to executing a command. Called with the command "
797
 
            "object.", (2, 6))
798
 
        self.add_hook('post_command',
799
 
            "Called after executing a command. Called with the command "
800
 
            "object.", (2, 6))
801
791
 
802
792
Command.hooks = CommandHooks()
803
793
 
935
925
        exitcode = trace.report_exception(exc_info, sys.stderr)
936
926
        if os.environ.get('BZR_PDB'):
937
927
            print '**** entering debugger'
 
928
            tb = exc_info[2]
938
929
            import pdb
939
 
            pdb.post_mortem(exc_info[2])
 
930
            if sys.version_info[:2] < (2, 6):
 
931
                # XXX: we want to do
 
932
                #    pdb.post_mortem(tb)
 
933
                # but because pdb.post_mortem gives bad results for tracebacks
 
934
                # from inside generators, we do it manually.
 
935
                # (http://bugs.python.org/issue4150, fixed in Python 2.6)
 
936
 
 
937
                # Setup pdb on the traceback
 
938
                p = pdb.Pdb()
 
939
                p.reset()
 
940
                p.setup(tb.tb_frame, tb)
 
941
                # Point the debugger at the deepest frame of the stack
 
942
                p.curindex = len(p.stack) - 1
 
943
                p.curframe = p.stack[p.curindex][0]
 
944
                # Start the pdb prompt.
 
945
                p.print_stack_entry(p.stack[p.curindex])
 
946
                p.execRcLines()
 
947
                p.cmdloop()
 
948
            else:
 
949
                pdb.post_mortem(tb)
940
950
        return exitcode
941
951
 
942
952