/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] up-to-date against bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
35
35
 
36
36
import bzrlib
37
37
import bzrlib.trace
38
 
from bzrlib.trace import mutter, note, log_error, warning
 
38
from bzrlib.trace import mutter, note, log_error, warning, be_quiet
39
39
from bzrlib.errors import (BzrError, 
40
40
                           BzrCheckError,
41
41
                           BzrCommandError,
168
168
        List of argument forms, marked with whether they are optional,
169
169
        repeated, etc.
170
170
 
 
171
                Examples:
 
172
 
 
173
                ['to_location', 'from_branch?', 'file*']
 
174
 
 
175
                'to_location' is required
 
176
                'from_branch' is optional
 
177
                'file' can be specified 0 or more times
 
178
 
171
179
    takes_options
172
180
        List of options that may be given for this command.  These can
173
181
        be either strings, referring to globally-defined options,
478
486
            opt_no_plugins = True
479
487
        elif a == '--builtin':
480
488
            opt_builtin = True
 
489
        elif a in ('--quiet', '-q'):
 
490
            be_quiet()
481
491
        else:
482
 
            break
 
492
            continue
483
493
        argv.remove(a)
484
494
 
485
495
    if (not argv) or (argv[0] == '--help'):
503
513
 
504
514
    cmd_obj = get_cmd_object(cmd, plugins_override=not opt_builtin)
505
515
 
506
 
    if opt_profile:
507
 
        ret = apply_profiled(cmd_obj.run_argv, argv)
508
 
    else:
509
 
        ret = cmd_obj.run_argv(argv)
510
 
    return ret or 0
 
516
    try:
 
517
        if opt_profile:
 
518
            ret = apply_profiled(cmd_obj.run_argv, argv)
 
519
        else:
 
520
            ret = cmd_obj.run_argv(argv)
 
521
        return ret or 0
 
522
    finally:
 
523
        # reset, in case we may do other commands later within the same process
 
524
        be_quiet(False)
511
525
 
512
526
def display_command(func):
513
527
    """Decorator that suppresses pipe/interrupt errors."""
526
540
            pass
527
541
    return ignore_pipe
528
542
 
 
543
 
529
544
def main(argv):
530
545
    import bzrlib.ui
 
546
    ## bzrlib.trace.enable_default_logging()
531
547
    bzrlib.trace.log_startup(argv)
532
548
    bzrlib.ui.ui_factory = bzrlib.ui.TextUIFactory()
533
 
 
534
 
    return run_bzr_catch_errors(argv[1:])
 
549
    ret = run_bzr_catch_errors(argv[1:])
 
550
    mutter("return code %d", ret)
 
551
    return ret
535
552
 
536
553
 
537
554
def run_bzr_catch_errors(argv):