/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/commands.py

Merge bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
449
449
 
450
450
        output_encoding = osutils.get_terminal_encoding()
451
451
 
452
 
        # use 'replace' so that we don't abort if trying to write out
453
 
        # in e.g. the default C locale.
454
 
        self.outf = codecs.getwriter(output_encoding)(sys.stdout, errors=self.encoding_type)
 
452
        self.outf = codecs.getwriter(output_encoding)(sys.stdout,
 
453
                        errors=self.encoding_type)
455
454
        # For whatever reason codecs.getwriter() does not advertise its encoding
456
455
        # it just returns the encoding of the wrapped file, which is completely
457
456
        # bogus. So set the attribute, so we can find the correct encoding later.
722
721
        return 0
723
722
 
724
723
    if argv[0] == '--version':
725
 
        from bzrlib.version import show_version
726
 
        show_version()
 
724
        from bzrlib.builtins import cmd_version
 
725
        cmd_version().run_argv_aliases([])
727
726
        return 0
728
727
        
729
728
    if not opt_no_plugins:
797
796
 
798
797
 
799
798
def run_bzr_catch_errors(argv):
 
799
    # Note: The except clause logic below should be kept in sync with the
 
800
    # profile() routine in lsprof.py.
800
801
    try:
801
802
        return run_bzr(argv)
802
803
    except (KeyboardInterrupt, Exception), e:
803
804
        # used to handle AssertionError and KeyboardInterrupt
804
805
        # specially here, but hopefully they're handled ok by the logger now
805
 
        trace.report_exception(sys.exc_info(), sys.stderr)
 
806
        exitcode = trace.report_exception(sys.exc_info(), sys.stderr)
806
807
        if os.environ.get('BZR_PDB'):
807
808
            print '**** entering debugger'
808
809
            import pdb
809
810
            pdb.post_mortem(sys.exc_traceback)
810
 
        return 3
 
811
        return exitcode
 
812
 
 
813
 
 
814
def run_bzr_catch_user_errors(argv):
 
815
    """Run bzr and report user errors, but let internal errors propagate.
 
816
 
 
817
    This is used for the test suite, and might be useful for other programs
 
818
    that want to wrap the commandline interface.
 
819
    """
 
820
    try:
 
821
        return run_bzr(argv)
 
822
    except Exception, e:
 
823
        if (isinstance(e, (OSError, IOError))
 
824
            or not getattr(e, 'internal_error', True)):
 
825
            trace.report_exception(sys.exc_info(), sys.stderr)
 
826
            return 3
 
827
        else:
 
828
            raise
811
829
 
812
830
 
813
831
class HelpCommandIndex(object):