Rev 6452: (jelmer) Use config stacks for 'suppress_warnings' configuration option. in file:///srv/pqm.bazaar-vcs.org/archives/thelove/bzr/%2Btrunk/

Patch Queue Manager pqm at pqm.ubuntu.com
Sat Jan 28 16:00:26 UTC 2012


At file:///srv/pqm.bazaar-vcs.org/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 6452 [merge]
revision-id: pqm at pqm.ubuntu.com-20120128160025-fw2c8vn92w31kmy1
parent: pqm at pqm.ubuntu.com-20120128132439-phvlss4cq7bf5rji
parent: jelmer at samba.org-20120127215934-d5lupaxico234zn6
committer: Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Sat 2012-01-28 16:00:25 +0000
message:
  (jelmer) Use config stacks for 'suppress_warnings' configuration option.
   (Jelmer Vernooij)
modified:
  bzrlib/config.py               config.py-20051011043216-070c74f4e9e338e8
  bzrlib/repository.py           rev_storage.py-20051111201905-119e9401e46257e3
  bzrlib/tests/blackbox/test_exceptions.py test_exceptions.py-20060604211237-yi2cxg0ose3xk4id-1
=== modified file 'bzrlib/config.py'
--- a/bzrlib/config.py	2012-01-20 13:21:01 +0000
+++ b/bzrlib/config.py	2012-01-27 21:59:34 +0000
@@ -2865,7 +2865,10 @@
 option_registry.register(
     Option('submit_to',
            help='''Where submissions from this branch are mailed to.'''))
-
+option_registry.register(
+    ListOption('suppress_warnings',
+           default=[],
+           help="List of warning classes to suppress."))
 option_registry.register_lazy('ssl.ca_certs',
     'bzrlib.transport.http._urllib2_wrappers', 'opt_ssl_ca_certs')
 

=== modified file 'bzrlib/repository.py'
--- a/bzrlib/repository.py	2011-12-30 00:15:51 +0000
+++ b/bzrlib/repository.py	2012-01-27 21:59:34 +0000
@@ -1224,10 +1224,10 @@
             return
         try:
             if branch is None:
-                conf = config.GlobalConfig()
+                conf = config.GlobalStack()
             else:
-                conf = branch.get_config()
-            if conf.suppress_warning('format_deprecation'):
+                conf = branch.get_config_stack()
+            if 'format_deprecation' in conf.get('suppress_warnings'):
                 return
             warning("Format %s for %s is deprecated -"
                     " please use 'bzr upgrade' to get better performance"

=== modified file 'bzrlib/tests/blackbox/test_exceptions.py'
--- a/bzrlib/tests/blackbox/test_exceptions.py	2011-12-09 17:09:06 +0000
+++ b/bzrlib/tests/blackbox/test_exceptions.py	2012-01-27 21:59:34 +0000
@@ -141,8 +141,8 @@
 
     def test_repository_deprecation_warning_suppressed_global(self):
         """Old formats give a warning"""
-        conf = config.GlobalConfig()
-        conf.set_user_option('suppress_warnings', 'format_deprecation')
+        conf = config.GlobalStack()
+        conf.set('suppress_warnings', 'format_deprecation')
         self.make_obsolete_repo('foo')
         self.enable_deprecation_warning()
         out, err = self.run_bzr('status', working_dir='foo')
@@ -151,8 +151,8 @@
     def test_repository_deprecation_warning_suppressed_locations(self):
         """Old formats give a warning"""
         self.make_obsolete_repo('foo')
-        conf = config.LocationConfig(osutils.pathjoin(self.test_dir, 'foo'))
-        conf.set_user_option('suppress_warnings', 'format_deprecation')
+        conf = config.LocationStack(osutils.pathjoin(self.test_dir, 'foo'))
+        conf.set('suppress_warnings', 'format_deprecation')
         self.enable_deprecation_warning()
         out, err = self.run_bzr('status', working_dir='foo')
         self.check_warning(False)
@@ -160,8 +160,8 @@
     def test_repository_deprecation_warning_suppressed_branch(self):
         """Old formats give a warning"""
         tree = self.make_obsolete_repo('foo')
-        conf = tree.branch.get_config()
-        conf.set_user_option('suppress_warnings', 'format_deprecation')
+        conf = tree.branch.get_config_stack()
+        conf.set('suppress_warnings', 'format_deprecation')
         self.enable_deprecation_warning()
         out, err = self.run_bzr('status', working_dir='foo')
         self.check_warning(False)




More information about the bazaar-commits mailing list