Rev 3759: (vila) Fix --verbose leaking into blackbox tests in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Thu Oct 2 07:54:07 BST 2008


At file:///home/pqm/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 3759
revision-id: pqm at pqm.ubuntu.com-20081002065404-0sjc6vwukw26m5wo
parent: pqm at pqm.ubuntu.com-20081001235145-nh3r3qcg0nwwmvdg
parent: v.ladeuil+lp at free.fr-20081002061842-4ctag1pkr7ua9gu2
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Thu 2008-10-02 07:54:04 +0100
message:
  (vila) Fix --verbose leaking into blackbox tests
modified:
  bzrlib/builtins.py             builtins.py-20050830033751-fc01482b9ca23183
  bzrlib/commands.py             bzr.py-20050309040720-d10f4714595cf8c3
  bzrlib/option.py               option.py-20051014052914-661fb36e76e7362f
  bzrlib/tests/test_options.py   testoptions.py-20051014093702-96457cfc86319a8f
    ------------------------------------------------------------
    revno: 3755.1.2
    revision-id: v.ladeuil+lp at free.fr-20081002061842-4ctag1pkr7ua9gu2
    parent: v.ladeuil+lp at free.fr-20081001102336-unf0wqcvw51x8igr
    parent: pqm at pqm.ubuntu.com-20081001123103-9powbklax4nmw09j
    committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
    branch nick: various
    timestamp: Thu 2008-10-02 08:18:42 +0200
    message:
      Fix conflict. Related to moved lines, nice use case
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
      bzr                            bzr.py-20050313053754-5485f144c7006fa6
      bzrlib/__init__.py             __init__.py-20050309040759-33e65acf91bbcd5d
      bzrlib/builtins.py             builtins.py-20050830033751-fc01482b9ca23183
      bzrlib/bundle/__init__.py      changeset.py-20050513021216-b02ab57fb9738913
      bzrlib/bzrdir.py               bzrdir.py-20060131065624-156dfea39c4387cb
      bzrlib/cmd_version_info.py     __init__.py-20051228204928-697d01fdca29c99b
      bzrlib/commands.py             bzr.py-20050309040720-d10f4714595cf8c3
      bzrlib/commit.py               commit.py-20050511101309-79ec1a0168e0e825
      bzrlib/config.py               config.py-20051011043216-070c74f4e9e338e8
      bzrlib/diff.py                 diff.py-20050309040759-26944fbbf2ebbf36
      bzrlib/directory_service.py    directory_service.py-20080305221044-vr2mkvlsk8jypa2y-1
      bzrlib/errors.py               errors.py-20050309040759-20512168c4e14fbd
      bzrlib/lock.py                 lock.py-20050527050856-ec090bb51bc03349
      bzrlib/lockdir.py              lockdir.py-20060220222025-98258adf27fbdda3
      bzrlib/mail_client.py          mail_client.py-20070809192806-vuxt3t19srtpjpdn-1
      bzrlib/msgeditor.py            msgeditor.py-20050901111708-ef6d8de98f5d8f2f
      bzrlib/option.py               option.py-20051014052914-661fb36e76e7362f
      bzrlib/osutils.py              osutils.py-20050309040759-eeaff12fbf77ac86
      bzrlib/patches.py              patches.py-20050727183609-378c1cc5972ce908
      bzrlib/plugin.py               plugin.py-20050622060424-829b654519533d69
      bzrlib/repofmt/knitrepo.py     knitrepo.py-20070206081537-pyy4a00xdas0j4pf-1
      bzrlib/repofmt/pack_repo.py    pack_repo.py-20070813041115-gjv5ma7ktfqwsjgn-1
      bzrlib/repofmt/weaverepo.py    presplitout.py-20070125045333-wfav3tsh73oxu3zk-1
      bzrlib/repository.py           rev_storage.py-20051111201905-119e9401e46257e3
      bzrlib/revision.py             revision.py-20050309040759-e77802c08f3999d5
      bzrlib/revisionspec.py         revisionspec.py-20050907152633-17567659fd5c0ddb
      bzrlib/smart/request.py        request.py-20061108095550-gunadhxmzkdjfeek-1
      bzrlib/smart/server.py         server.py-20061110062051-chzu10y32vx8gvur-1
      bzrlib/status.py               status.py-20050505062338-431bfa63ec9b19e6
      bzrlib/store/__init__.py       store.py-20050309040759-164dc5173d6406c2
      bzrlib/store/versioned/__init__.py weavestore.py-20050907094258-88262e0434babab9
      bzrlib/tag.py                  tag.py-20070212110532-91cw79inah2cfozx-1
      bzrlib/tests/__init__.py       selftest.py-20050531073622-8d0e3c8845c97a64
      bzrlib/tests/blackbox/test_commit.py test_commit.py-20060212094538-ae88fc861d969db0
      bzrlib/tests/blackbox/test_log.py test_log.py-20060112090212-78f6ea560c868e24
      bzrlib/tests/blackbox/test_non_ascii.py test_non_ascii.py-20060105214030-68010be784a5d854
      bzrlib/tests/blackbox/test_status.py teststatus.py-20050712014354-508855eb9f29f7dc
      bzrlib/tests/blackbox/test_version.py test_version.py-20070312060045-ol7th9z035r3im3d-1
      bzrlib/tests/test_msgeditor.py test_msgeditor.py-20051202041359-920315ec6011ee51
      bzrlib/tests/test_options.py   testoptions.py-20051014093702-96457cfc86319a8f
      bzrlib/tests/test_osutils.py   test_osutils.py-20051201224856-e48ee24c12182989
      bzrlib/tests/test_osutils_encodings.py test_osutils_encodin-20061226013130-kkp732tpt3lm91vv-1
      bzrlib/tests/test_selftest.py  test_selftest.py-20051202044319-c110a115d8c0456a
      bzrlib/tests/test_urlutils.py  test_urlutils.py-20060502192900-46b1f9579987cf9c
      bzrlib/util/configobj/configobj.py configobj.py-20051018184548-06992a2246425e3e
      bzrlib/version.py              version.py-20060816024207-ves6ult9a11taj9t-1
      bzrlib/versionedfile.py        versionedfile.py-20060222045106-5039c71ee3b65490
      bzrlib/weave.py                knit.py-20050627021749-759c29984154256b
      bzrlib/win32utils.py           win32console.py-20051021033308-123c6c929d04973d
    ------------------------------------------------------------
    revno: 3755.1.1
    revision-id: v.ladeuil+lp at free.fr-20081001102336-unf0wqcvw51x8igr
    parent: pqm at pqm.ubuntu.com-20081001064910-typ6d7diwd53z6iv
    committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
    branch nick: various
    timestamp: Wed 2008-10-01 12:23:36 +0200
    message:
      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 ?).
    modified:
      bzrlib/builtins.py             builtins.py-20050830033751-fc01482b9ca23183
      bzrlib/commands.py             bzr.py-20050309040720-d10f4714595cf8c3
      bzrlib/option.py               option.py-20051014052914-661fb36e76e7362f
      bzrlib/tests/test_options.py   testoptions.py-20051014093702-96457cfc86319a8f
=== modified file 'bzrlib/builtins.py'
--- a/bzrlib/builtins.py	2008-10-01 05:40:45 +0000
+++ b/bzrlib/builtins.py	2008-10-02 06:18:42 +0000
@@ -1681,9 +1681,7 @@
     takes_options = [
             Option('forward',
                    help='Show from oldest to newest.'),
-            Option('timezone',
-                   type=str,
-                   help='Display timezone as local, original, or utc.'),
+            'timezone',
             custom_help('verbose',
                    help='Show files changed in each revision.'),
             'show-ids',

=== modified file 'bzrlib/commands.py'
--- a/bzrlib/commands.py	2008-10-01 05:40:45 +0000
+++ b/bzrlib/commands.py	2008-10-02 06:18:42 +0000
@@ -671,9 +671,6 @@
 def run_bzr(argv):
     """Execute a command.
 
-    This is similar to main(), but without all the trappings for
-    logging and error handling.  
-    
     argv
        The command-line arguments, without the program name from argv[0]
        These should already be decoded. All library/test code calling
@@ -751,7 +748,7 @@
         from bzrlib.builtins import cmd_version
         cmd_version().run_argv_aliases([])
         return 0
-        
+
     if not opt_no_plugins:
         from bzrlib.plugin import load_plugins
         load_plugins()
@@ -778,6 +775,10 @@
     run_argv = [argv, alias_argv]
 
     try:
+        # We can be called recursively (tests for example), but we don't want
+        # the verbosity level to propagate.
+        saved_verbosity_level = option._verbosity_level
+        option._verbosity_level = 0
         if opt_lsprof:
             if opt_coverage_dir:
                 trace.warning(
@@ -796,8 +797,10 @@
             trace.debug_memory('Process status after command:', short=False)
         return ret or 0
     finally:
-        # reset, in case we may do other commands later within the same process
-        option._verbosity_level = 0
+        # reset, in case we may do other commands later within the same
+        # process. Commands that want to execute sub-commands must propagate
+        # --verbose in their own way.
+        option._verbosity_level = saved_verbosity_level
 
 def display_command(func):
     """Decorator that suppresses pipe/interrupt errors."""
@@ -823,7 +826,7 @@
     import bzrlib.ui
     from bzrlib.ui.text import TextUIFactory
     bzrlib.ui.ui_factory = TextUIFactory()
-     
+
     # Is this a final release version? If so, we should suppress warnings
     if bzrlib.version_info[3] == 'final':
         from bzrlib import symbol_versioning

=== modified file 'bzrlib/option.py'
--- a/bzrlib/option.py	2008-09-14 10:46:46 +0000
+++ b/bzrlib/option.py	2008-10-02 06:18:42 +0000
@@ -456,11 +456,6 @@
     Option.OPTIONS[name] = RegistryOption(name, help, registry, **kwargs)
 
 
-class MergeTypeRegistry(_mod_registry.Registry):
-
-    pass
-
-
 # This is the verbosity level detected during command line parsing.
 # Note that the final value is dependent on the order in which the
 # various flags (verbose, quiet, no-verbose, no-quiet) are given.
@@ -489,6 +484,11 @@
             _verbosity_level = -1
 
 
+class MergeTypeRegistry(_mod_registry.Registry):
+
+    pass
+
+
 _merge_type_registry = MergeTypeRegistry()
 _merge_type_registry.register_lazy('merge3', 'bzrlib.merge', 'Merge3Merger',
                                    "Native diff3-style merge")
@@ -537,9 +537,9 @@
                help='Select changes introduced by the specified revision. See also "help revisionspec".')
 _global_option('show-ids',
                help='Show internal object ids.')
-_global_option('timezone', 
+_global_option('timezone',
                type=str,
-               help='display timezone as local, original, or utc')
+               help='Display timezone as local, original, or utc.')
 _global_option('unbound')
 _global_option('version')
 _global_option('email')

=== modified file 'bzrlib/tests/test_options.py'
--- a/bzrlib/tests/test_options.py	2008-09-14 10:46:46 +0000
+++ b/bzrlib/tests/test_options.py	2008-10-02 06:18:42 +0000
@@ -362,13 +362,13 @@
         # period and be all on a single line, because the display code will
         # wrap it.
         option_re = re.compile(r'^[A-Z][^\n]+\.$')
-        for scope, option in self.get_builtin_command_options():
-            if not option.help:
-                msgs.append('%-16s %-16s %s' %
-                       ((scope or 'GLOBAL'), option.name, 'NO HELP'))
-            elif not option_re.match(option.help):
-                msgs.append('%-16s %-16s %s' %
-                        ((scope or 'GLOBAL'), option.name, option.help))
+        for scope, opt in self.get_builtin_command_options():
+            if not opt.help:
+                msgs.append('%-16s %-16s %s' %
+                       ((scope or 'GLOBAL'), opt.name, 'NO HELP'))
+            elif not option_re.match(opt.help):
+                msgs.append('%-16s %-16s %s' %
+                        ((scope or 'GLOBAL'), opt.name, opt.help))
         if msgs:
             self.fail("The following options don't match the style guide:\n"
                     + '\n'.join(msgs))




More information about the bazaar-commits mailing list