Rev 5945: (vila) Migrate 'editor' to the new config scheme. (Vincent Ladeuil) in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Tue May 31 21:50:49 UTC 2011
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 5945 [merge]
revision-id: pqm at pqm.ubuntu.com-20110531215047-sxah2raqyplbxwcw
parent: pqm at pqm.ubuntu.com-20110531202224-lq6h1sol9sjr29oe
parent: v.ladeuil+lp at free.fr-20110531210852-0uyfsjkws5zbfs8m
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Tue 2011-05-31 21:50:47 +0000
message:
(vila) Migrate 'editor' to the new config scheme. (Vincent Ladeuil)
modified:
bzrlib/config.py config.py-20051011043216-070c74f4e9e338e8
bzrlib/msgeditor.py msgeditor.py-20050901111708-ef6d8de98f5d8f2f
bzrlib/tests/__init__.py selftest.py-20050531073622-8d0e3c8845c97a64
bzrlib/tests/test_config.py testconfig.py-20051011041908-742d0c15d8d8c8eb
=== modified file 'bzrlib/config.py'
--- a/bzrlib/config.py 2011-05-31 20:22:24 +0000
+++ b/bzrlib/config.py 2011-05-31 21:08:52 +0000
@@ -97,6 +97,10 @@
from bzrlib import (
registry,
)
+from bzrlib.symbol_versioning import (
+ deprecated_in,
+ deprecated_method,
+ )
CHECK_IF_POSSIBLE=0
@@ -188,6 +192,7 @@
"""Returns a unique ID for the config."""
raise NotImplementedError(self.config_id)
+ @deprecated_method(deprecated_in((2, 4, 0)))
def get_editor(self):
"""Get the users pop up editor."""
raise NotImplementedError
@@ -910,6 +915,7 @@
conf._create_from_string(str_or_unicode, save)
return conf
+ @deprecated_method(deprecated_in((2, 4, 0)))
def get_editor(self):
return self._get_user_option('editor')
@@ -2114,9 +2120,9 @@
option_registry = registry.Registry()
-# FIXME: Delete the following dummy option once we register the real ones
-# -- vila 20110515
-option_registry.register('foo', Option('foo'), help='Dummy option')
+option_registry.register(
+ 'editor', Option('editor'),
+ help='The command called to launch an editor to enter a message.')
class Section(object):
=== modified file 'bzrlib/msgeditor.py'
--- a/bzrlib/msgeditor.py 2011-05-27 05:16:48 +0000
+++ b/bzrlib/msgeditor.py 2011-05-31 21:08:52 +0000
@@ -41,7 +41,7 @@
except KeyError:
pass
- e = config.GlobalConfig().get_editor()
+ e = config.GlobalStack().get('editor')
if e is not None:
yield e, config.config_filename()
=== modified file 'bzrlib/tests/__init__.py'
--- a/bzrlib/tests/__init__.py 2011-05-27 21:41:02 +0000
+++ b/bzrlib/tests/__init__.py 2011-05-31 21:08:52 +0000
@@ -1546,7 +1546,8 @@
not other callers that go direct to the warning module.
To test that a deprecated method raises an error, do something like
- this::
+ this (remember that both assertRaises and applyDeprecated delays *args
+ and **kwargs passing)::
self.assertRaises(errors.ReservedId,
self.applyDeprecated,
=== modified file 'bzrlib/tests/test_config.py'
--- a/bzrlib/tests/test_config.py 2011-05-31 20:22:24 +0000
+++ b/bzrlib/tests/test_config.py 2011-05-31 21:08:52 +0000
@@ -41,6 +41,10 @@
trace,
transport,
)
+from bzrlib.symbol_versioning import (
+ deprecated_in,
+ deprecated_method,
+ )
from bzrlib.transport import remote
from bzrlib.tests import (
features,
@@ -474,7 +478,10 @@
config.Config()
def test_no_default_editor(self):
- self.assertRaises(NotImplementedError, config.Config().get_editor)
+ self.assertRaises(
+ NotImplementedError,
+ self.applyDeprecated, deprecated_in((2, 4, 0)),
+ config.Config().get_editor)
def test_user_email(self):
my_config = InstrumentedConfig()
@@ -1188,7 +1195,9 @@
def test_configured_editor(self):
my_config = config.GlobalConfig.from_string(sample_config_text)
- self.assertEqual("vim", my_config.get_editor())
+ editor = self.applyDeprecated(
+ deprecated_in((2, 4, 0)), my_config.get_editor)
+ self.assertEqual('vim', editor)
def test_signatures_always(self):
my_config = config.GlobalConfig.from_string(sample_always_signatures)
More information about the bazaar-commits
mailing list