/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

  • Committer: Vincent Ladeuil
  • Date: 2008-10-01 10:23:36 UTC
  • mto: This revision was merged to the branch mainline in revision 3759.
  • Revision ID: v.ladeuil+lp@free.fr-20081001102336-unf0wqcvw51x8igr
Fix --verbose leaking into blackbox tests.

* bzrlib/commands.py:
(run_bzr): Save/restore verbosity_level to avoid leaks.

* bzrlib/tests/test_options.py:
(TestOptionDefinitions.test_option_grammar): Don't use 'option'
module name as a variable name.

* bzrlib/option.py:
(MergeTypeRegistry): Cleanup. This has been separated from the
related code by the '_verbosity_level' definition/code insertion.
(timezone): Respect style rules.

* bzrlib/builtins.py:
(cmd_log): Don't mask the global option for no good reason (or
should we delete the global option instead ?).

Show diffs side-by-side

added added

removed removed

Lines of Context:
675
675
def run_bzr(argv):
676
676
    """Execute a command.
677
677
 
678
 
    This is similar to main(), but without all the trappings for
679
 
    logging and error handling.  
680
 
    
681
678
    argv
682
679
       The command-line arguments, without the program name from argv[0]
683
680
       These should already be decoded. All library/test code calling
755
752
        from bzrlib.builtins import cmd_version
756
753
        cmd_version().run_argv_aliases([])
757
754
        return 0
758
 
        
 
755
 
759
756
    if not opt_no_plugins:
760
757
        from bzrlib.plugin import load_plugins
761
758
        load_plugins()
781
778
    run_argv = [argv, alias_argv]
782
779
 
783
780
    try:
 
781
        # We can be called recursively (tests for example), but we don't want
 
782
        # the verbosity level to propagate.
 
783
        saved_verbosity_level = option._verbosity_level
 
784
        option._verbosity_level = 0
784
785
        if opt_lsprof:
785
786
            if opt_coverage_dir:
786
787
                trace.warning(
799
800
            trace.debug_memory('Process status after command:', short=False)
800
801
        return ret or 0
801
802
    finally:
802
 
        # reset, in case we may do other commands later within the same process
803
 
        option._verbosity_level = 0
 
803
        # reset, in case we may do other commands later within the same
 
804
        # process. Commands that want to execute sub-commands must propagate
 
805
        # --verbose in their own way.
 
806
        option._verbosity_level = saved_verbosity_level
804
807
 
805
808
def display_command(func):
806
809
    """Decorator that suppresses pipe/interrupt errors."""
826
829
    import bzrlib.ui
827
830
    from bzrlib.ui.text import TextUIFactory
828
831
    bzrlib.ui.ui_factory = TextUIFactory()
829
 
     
 
832
 
830
833
    # Is this a final release version? If so, we should suppress warnings
831
834
    if bzrlib.version_info[3] == 'final':
832
835
        from bzrlib import symbol_versioning