~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/commands.py

  • Committer: Robert Collins
  • Date: 2005-11-28 05:13:41 UTC
  • mfrom: (1185.33.54 merge-recovered)
  • Revision ID: robertc@robertcollins.net-20051128051341-059936f2f29a12c8
Merge from Martin. Adjust check to work with HTTP again.

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,
486
486
            opt_no_plugins = True
487
487
        elif a == '--builtin':
488
488
            opt_builtin = True
 
489
        elif a in ('--quiet', '-q'):
 
490
            be_quiet()
489
491
        else:
490
 
            break
 
492
            continue
491
493
        argv.remove(a)
492
494
 
493
495
    if (not argv) or (argv[0] == '--help'):
511
513
 
512
514
    cmd_obj = get_cmd_object(cmd, plugins_override=not opt_builtin)
513
515
 
514
 
    if opt_profile:
515
 
        ret = apply_profiled(cmd_obj.run_argv, argv)
516
 
    else:
517
 
        ret = cmd_obj.run_argv(argv)
518
 
    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)
519
525
 
520
526
def display_command(func):
521
527
    """Decorator that suppresses pipe/interrupt errors."""
534
540
            pass
535
541
    return ignore_pipe
536
542
 
 
543
 
537
544
def main(argv):
538
545
    import bzrlib.ui
 
546
    ## bzrlib.trace.enable_default_logging()
539
547
    bzrlib.trace.log_startup(argv)
540
548
    bzrlib.ui.ui_factory = bzrlib.ui.TextUIFactory()
541
 
 
542
 
    return run_bzr_catch_errors(argv[1:])
 
549
    ret = run_bzr_catch_errors(argv[1:])
 
550
    mutter("return code %d", ret)
 
551
    return ret
543
552
 
544
553
 
545
554
def run_bzr_catch_errors(argv):