~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/commands.py

fixme note for bzr status

Show diffs side-by-side

added added

removed removed

Lines of Context:
41
41
import bzrlib
42
42
import bzrlib.trace
43
43
from bzrlib.trace import mutter, note, log_error, warning
44
 
from bzrlib.errors import BzrError, BzrCheckError, BzrCommandError, NotBranchError
 
44
from bzrlib.errors import BzrError, BzrCheckError, BzrCommandError
45
45
from bzrlib.branch import find_branch
46
46
from bzrlib import BZRDIR
47
47
 
155
155
        msg = "No known merge type %s. Supported types are:\n%s" %\
156
156
            (typestring, type_list)
157
157
        raise BzrCommandError(msg)
 
158
    
 
159
 
 
160
def get_merge_type(typestring):
 
161
    """Attempt to find the merge class/factory associated with a string."""
 
162
    from merge import merge_types
 
163
    try:
 
164
        return merge_types[typestring][0]
 
165
    except KeyError:
 
166
        templ = '%s%%7s: %%s' % (' '*12)
 
167
        lines = [templ % (f[0], f[1][1]) for f in merge_types.iteritems()]
 
168
        type_list = '\n'.join(lines)
 
169
        msg = "No known merge type %s. Supported types are:\n%s" %\
 
170
            (typestring, type_list)
 
171
        raise BzrCommandError(msg)
158
172
 
159
173
 
160
174
def _builtin_commands():
587
601
    --profile
588
602
        Run under the Python profiler.
589
603
    """
590
 
    # Load all of the transport methods
591
 
    import bzrlib.transport.local, bzrlib.transport.http
592
604
    
593
605
    argv = [a.decode(bzrlib.user_encoding) for a in argv]
594
606
 
644
656
 
645
657
    try:
646
658
        try:
647
 
            try:
648
 
                return run_bzr(argv[1:])
649
 
            finally:
650
 
                # do this here inside the exception wrappers to catch EPIPE
651
 
                sys.stdout.flush()
652
 
        #wrap common errors as CommandErrors.
653
 
        except (NotBranchError,), e:
654
 
            raise BzrCommandError(str(e))
 
659
            return run_bzr(argv[1:])
 
660
        finally:
 
661
            # do this here inside the exception wrappers to catch EPIPE
 
662
            sys.stdout.flush()
655
663
    except BzrCommandError, e:
656
664
        # command line syntax error, etc
657
665
        log_error(str(e))
676
684
            bzrlib.trace.log_exception()
677
685
            return 2
678
686
 
 
687
 
679
688
if __name__ == '__main__':
680
689
    sys.exit(main(sys.argv))