Rev 6040: Remove deprecated code in file:///home/vila/src/bzr/cleanup/deprecations/

Vincent Ladeuil v.ladeuil+lp at free.fr
Wed Mar 14 08:34:11 UTC 2012


At file:///home/vila/src/bzr/cleanup/deprecations/

------------------------------------------------------------
revno: 6040
revision-id: v.ladeuil+lp at free.fr-20120314083410-knnbugxnq7owem53
parent: v.ladeuil+lp at free.fr-20120313172529-i0suyjnepsor25i7
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: deprecations
timestamp: Wed 2012-03-14 09:34:10 +0100
message:
  Remove deprecated code
-------------- next part --------------
=== modified file 'bzrlib/hooks.py'
--- a/bzrlib/hooks.py	2012-01-02 14:41:49 +0000
+++ b/bzrlib/hooks.py	2012-03-14 08:34:10 +0000
@@ -106,12 +106,6 @@
     return pyutils.get_named_object(module_name, member_name)
 
 
- at symbol_versioning.deprecated_function(symbol_versioning.deprecated_in((2, 3)))
-def known_hooks_key_to_parent_and_attribute(key):
-    """See KnownHooksRegistry.key_to_parent_and_attribute."""
-    return known_hooks.key_to_parent_and_attribute(key)
-
-
 class Hooks(dict):
     """A dictionary mapping hook name to a list of callables.
 
@@ -153,18 +147,6 @@
                               deprecated=deprecated, callbacks=callbacks)
         self[name] = hookpoint
 
-    @symbol_versioning.deprecated_method(symbol_versioning.deprecated_in((2, 4)))
-    def create_hook(self, hook):
-        """Create a hook which can have callbacks registered for it.
-
-        :param hook: The hook to create. An object meeting the protocol of
-            bzrlib.hooks.HookPoint. It's name is used as the key for future
-            lookups.
-        """
-        if hook.name in self:
-            raise errors.DuplicateKey(hook.name)
-        self[hook.name] = hook
-
     def docs(self):
         """Generate the documentation for this Hooks instance.
 

=== modified file 'bzrlib/inventory.py'
--- a/bzrlib/inventory.py	2012-03-05 17:29:08 +0000
+++ b/bzrlib/inventory.py	2012-03-14 08:34:10 +0000
@@ -633,24 +633,6 @@
     inserted, other than through the Inventory API.
     """
 
-    @deprecated_method(deprecated_in((2, 4, 0)))
-    def __contains__(self, file_id):
-        """True if this entry contains a file with given id.
-
-        >>> inv = Inventory()
-        >>> inv.add(InventoryFile('123', 'foo.c', ROOT_ID))
-        InventoryFile('123', 'foo.c', parent_id='TREE_ROOT', sha1=None, len=None, revision=None)
-        >>> inv.has_id('123')
-        True
-        >>> inv.has_id('456')
-        False
-
-        Note that this method along with __iter__ are not encouraged for use as
-        they are less clear than specific query methods - they may be rmeoved
-        in the future.
-        """
-        return self.has_id(file_id)
-
     def has_filename(self, filename):
         return bool(self.path2id(filename))
 

=== modified file 'bzrlib/repofmt/knitrepo.py'
--- a/bzrlib/repofmt/knitrepo.py	2012-02-23 19:45:15 +0000
+++ b/bzrlib/repofmt/knitrepo.py	2012-03-14 08:34:10 +0000
@@ -488,21 +488,9 @@
 
     @needs_read_lock
     def search_missing_revision_ids(self,
-            revision_id=symbol_versioning.DEPRECATED_PARAMETER,
             find_ghosts=True, revision_ids=None, if_present_ids=None,
             limit=None):
         """See InterRepository.search_missing_revision_ids()."""
-        if symbol_versioning.deprecated_passed(revision_id):
-            symbol_versioning.warn(
-                'search_missing_revision_ids(revision_id=...) was '
-                'deprecated in 2.4.  Use revision_ids=[...] instead.',
-                DeprecationWarning, stacklevel=2)
-            if revision_ids is not None:
-                raise AssertionError(
-                    'revision_ids is mutually exclusive with revision_id')
-            if revision_id is not None:
-                revision_ids = [revision_id]
-        del revision_id
         source_ids_set = self._present_source_revisions_for(
             revision_ids, if_present_ids)
         # source_ids is the worst possible case we may need to pull.

=== modified file 'bzrlib/tests/per_inventory/basics.py'
--- a/bzrlib/tests/per_inventory/basics.py	2011-06-14 02:21:41 +0000
+++ b/bzrlib/tests/per_inventory/basics.py	2012-03-14 08:34:10 +0000
@@ -152,10 +152,6 @@
         inv = self.inv_to_test_inv(inv)
         self.assertEqual(inv.path2id('src'), 'src-id')
         self.assertEqual(inv.path2id('src/bye.c'), 'bye-id')
-        self.assertTrue(
-            self.applyDeprecated(
-                deprecated_in((2, 4, 0)),
-                inv.__contains__, 'src-id'))
 
     def test_non_directory_children(self):
         """Test path2id when a parent directory has no children"""

=== modified file 'bzrlib/tests/test_hooks.py'
--- a/bzrlib/tests/test_hooks.py	2012-01-02 14:41:49 +0000
+++ b/bzrlib/tests/test_hooks.py	2012-03-14 08:34:10 +0000
@@ -29,7 +29,6 @@
     install_lazy_named_hook,
     known_hooks,
     known_hooks_key_to_object,
-    known_hooks_key_to_parent_and_attribute,
     )
 from bzrlib.symbol_versioning import (
     deprecated_in,
@@ -38,25 +37,6 @@
 
 class TestHooks(tests.TestCase):
 
-    def test_create_hook_first(self):
-        hooks = Hooks("bzrlib.tests.test_hooks", "some_hooks")
-        doc = ("Invoked after changing the tip of a branch object. Called with"
-            "a bzrlib.branch.PostChangeBranchTipParams object")
-        hook = HookPoint("post_tip_change", doc, (0, 15), None)
-        self.applyDeprecated(deprecated_in((2, 4)), hooks.create_hook, hook)
-        self.assertEqual(hook, hooks['post_tip_change'])
-
-    def test_create_hook_name_collision_errors(self):
-        hooks = Hooks("bzrlib.tests.test_hooks", "some_hooks")
-        doc = ("Invoked after changing the tip of a branch object. Called with"
-            "a bzrlib.branch.PostChangeBranchTipParams object")
-        hook = HookPoint("post_tip_change", doc, (0, 15), None)
-        hook2 = HookPoint("post_tip_change", None, None, None)
-        self.applyDeprecated(deprecated_in((2, 4)), hooks.create_hook, hook)
-        self.assertRaises(errors.DuplicateKey, self.applyDeprecated,
-            deprecated_in((2, 4, 0)), hooks.create_hook, hook2)
-        self.assertEqual(hook, hooks['post_tip_change'])
-
     def test_docs(self):
         """docs() should return something reasonable about the Hooks."""
         class MyHooks(Hooks):
@@ -286,16 +266,6 @@
         self.assertIs(branch.Branch.hooks,
             known_hooks_key_to_object(('bzrlib.branch', 'Branch.hooks')))
 
-    def test_known_hooks_key_to_parent_and_attribute_deprecated(self):
-        self.assertEqual((branch.Branch, 'hooks'),
-            self.applyDeprecated(deprecated_in((2,3)),
-                known_hooks_key_to_parent_and_attribute,
-                ('bzrlib.branch', 'Branch.hooks')))
-        self.assertEqual((branch, 'Branch'),
-            self.applyDeprecated(deprecated_in((2,3)),
-                known_hooks_key_to_parent_and_attribute,
-                ('bzrlib.branch', 'Branch')))
-
     def test_known_hooks_key_to_parent_and_attribute(self):
         self.assertEqual((branch.Branch, 'hooks'),
             known_hooks.key_to_parent_and_attribute(

=== modified file 'bzrlib/tests/test_workingtree.py'
--- a/bzrlib/tests/test_workingtree.py	2011-12-22 19:54:56 +0000
+++ b/bzrlib/tests/test_workingtree.py	2012-03-14 08:34:10 +0000
@@ -218,31 +218,6 @@
                           workingtree.WorkingTreeFormatMetaDir.find_format,
                           dir)
 
-    def test_register_unregister_format(self):
-        format = SampleTreeFormat()
-        # make a control dir
-        dir = bzrdir.BzrDirMetaFormat1().initialize('.')
-        dir.create_repository()
-        dir.create_branch()
-        # make a branch
-        format.initialize(dir)
-        # register a format for it.
-        self.applyDeprecated(symbol_versioning.deprecated_in((2, 4, 0)),
-            workingtree.WorkingTreeFormat.register_format, format)
-        self.assertTrue(format in 
-            self.applyDeprecated(symbol_versioning.deprecated_in((2, 4, 0)),
-                workingtree.WorkingTreeFormat.get_formats))
-        # which branch.Open will refuse (not supported)
-        self.assertRaises(errors.UnsupportedFormatError, workingtree.WorkingTree.open, '.')
-        # but open_downlevel will work
-        self.assertEqual(format.open(dir), workingtree.WorkingTree.open_downlevel('.'))
-        # unregister the format
-        self.applyDeprecated(symbol_versioning.deprecated_in((2, 4, 0)),
-            workingtree.WorkingTreeFormat.unregister_format, format)
-        self.assertFalse(format in
-            self.applyDeprecated(symbol_versioning.deprecated_in((2, 4, 0)),
-                workingtree.WorkingTreeFormat.get_formats))
-
     def test_find_format_with_features(self):
         tree = self.make_branch_and_tree('.', format='2a')
         tree.update_feature_flags({"name": "necessity"})

=== modified file 'bzrlib/transport/ftp/__init__.py'
--- a/bzrlib/transport/ftp/__init__.py	2011-12-19 13:23:58 +0000
+++ b/bzrlib/transport/ftp/__init__.py	2012-03-14 08:34:10 +0000
@@ -248,7 +248,7 @@
             mutter("FTP has not: %s: %s", abspath, e)
             return False
 
-    def get(self, relpath, decode=DEPRECATED_PARAMETER, retries=0):
+    def get(self, relpath, retries=0):
         """Get the file at the given relative path.
 
         :param relpath: The relative path to the file
@@ -258,10 +258,6 @@
         We're meant to return a file-like object which bzr will
         then read from. For now we do this via the magic of StringIO
         """
-        if deprecated_passed(decode):
-            warn(deprecated_in((2,3,0)) %
-                 '"decode" parameter to FtpTransport.get()',
-                 DeprecationWarning, stacklevel=2)
         try:
             mutter("FTP get: %s", self._remote_path(relpath))
             f = self._get_FTP()
@@ -279,7 +275,7 @@
             else:
                 warning("FTP temporary error: %s. Retrying.", str(e))
                 self._reconnect()
-                return self.get(relpath, decode, retries+1)
+                return self.get(relpath, retries+1)
         except EOFError, e:
             if retries > _number_of_retries:
                 raise errors.TransportError("FTP control connection closed during GET %s."
@@ -289,7 +285,7 @@
                 warning("FTP control connection closed. Trying to reopen.")
                 time.sleep(_sleep_between_retries)
                 self._reconnect()
-                return self.get(relpath, decode, retries+1)
+                return self.get(relpath, retries+1)
 
     def put_file(self, relpath, fp, mode=None, retries=0):
         """Copy the file-like or string object into the location.

=== modified file 'bzrlib/transport/gio_transport.py'
--- a/bzrlib/transport/gio_transport.py	2011-12-19 13:23:58 +0000
+++ b/bzrlib/transport/gio_transport.py	2012-03-14 08:34:10 +0000
@@ -271,7 +271,7 @@
             else:
                 self._translate_gio_error(e, relpath)
 
-    def get(self, relpath, decode=DEPRECATED_PARAMETER, retries=0):
+    def get(self, relpath, retries=0):
         """Get the file at the given relative path.
 
         :param relpath: The relative path to the file
@@ -281,10 +281,6 @@
         We're meant to return a file-like object which bzr will
         then read from. For now we do this via the magic of StringIO
         """
-        if deprecated_passed(decode):
-            warn(deprecated_in((2,3,0)) %
-                 '"decode" parameter to GioTransport.get()',
-                 DeprecationWarning, stacklevel=2)
         try:
             if 'gio' in debug.debug_flags:
                 mutter("GIO get: %s" % relpath)

=== modified file 'bzrlib/workingtree.py'
--- a/bzrlib/workingtree.py	2012-02-17 16:39:09 +0000
+++ b/bzrlib/workingtree.py	2012-03-14 08:34:10 +0000
@@ -3078,13 +3078,6 @@
     def __ne__(self, other):
         return not (self == other)
 
-    @classmethod
-    @symbol_versioning.deprecated_method(
-        symbol_versioning.deprecated_in((2, 4, 0)))
-    def get_default_format(klass):
-        """Return the current default format."""
-        return format_registry.get_default()
-
     def get_format_description(self):
         """Return the short description for this format."""
         raise NotImplementedError(self.get_format_description)
@@ -3106,42 +3099,6 @@
         """True if this format supports stored views."""
         return False
 
-    @classmethod
-    @symbol_versioning.deprecated_method(
-        symbol_versioning.deprecated_in((2, 4, 0)))
-    def register_format(klass, format):
-        format_registry.register(format)
-
-    @classmethod
-    @symbol_versioning.deprecated_method(
-        symbol_versioning.deprecated_in((2, 4, 0)))
-    def register_extra_format(klass, format):
-        format_registry.register_extra(format)
-
-    @classmethod
-    @symbol_versioning.deprecated_method(
-        symbol_versioning.deprecated_in((2, 4, 0)))
-    def unregister_extra_format(klass, format):
-        format_registry.unregister_extra(format)
-
-    @classmethod
-    @symbol_versioning.deprecated_method(
-        symbol_versioning.deprecated_in((2, 4, 0)))
-    def get_formats(klass):
-        return format_registry._get_all()
-
-    @classmethod
-    @symbol_versioning.deprecated_method(
-        symbol_versioning.deprecated_in((2, 4, 0)))
-    def set_default_format(klass, format):
-        format_registry.set_default(format)
-
-    @classmethod
-    @symbol_versioning.deprecated_method(
-        symbol_versioning.deprecated_in((2, 4, 0)))
-    def unregister_format(klass, format):
-        format_registry.remove(format)
-
     def get_controldir_for_branch(self):
         """Get the control directory format for creating branches.
 

=== modified file 'doc/en/release-notes/bzr-2.5.txt'
--- a/doc/en/release-notes/bzr-2.5.txt	2012-03-13 17:25:29 +0000
+++ b/doc/en/release-notes/bzr-2.5.txt	2012-03-14 08:34:10 +0000
@@ -1147,11 +1147,6 @@
   remove ``log.show_one_log`` which was never properly deprecated but wasn't
   used and is easy to inline if needed. (Vincent Ladeuil)
 
-* Remove ``Merger.ensure_revision_trees``, ``Merger.file_revisions``,
-  ``Merger.check_basis`` and ``Merger.compare_basis`` deprecated in 2.1.0 as
-  well as ``Merge3Merger.scalar_three_way`` deprecated in 2.2.0.
-  (Vincent Ladeuil)
-
 * Remove ``trace.info``, ``trace.error`` and ``trace.show_log_error``
   deprecated in 2.1.0. (Vincent Ladeuil)
 

=== modified file 'doc/en/release-notes/bzr-2.6.txt'
--- a/doc/en/release-notes/bzr-2.6.txt	2012-03-12 13:38:09 +0000
+++ b/doc/en/release-notes/bzr-2.6.txt	2012-03-14 08:34:10 +0000
@@ -89,6 +89,19 @@
 * New convenience API method ``WorkingTree.get_config_stack``.
   (Jelmer Vernooij)
 
+* Remove ``Merge3Merger.scalar_three_way`` deprecated in 2.2.0,
+  ``hooks.known_hooks_key_to_parent_and_attribute`` deprecated in 2.3,
+  ``hooks.Hooks.create_hook`` deprecated in 2.4,
+  ``inventory.Inventory.__contains__`` deprecated in 2.4.0,
+  ``workingtree.WorkingTreeFormat.get_default_format`` deprecated in 2.4.0,
+  ``workingtree.WorkingTreeFormat.register_format`` deprecated in 2.4.0,
+  ``workingtree.WorkingTreeFormat.register_extra_format`` deprecated in 2.4.0,
+  ``workingtree.WorkingTreeFormat.unregister_extra_format`` deprecated in 2.4.0,
+  ``workingtree.WorkingTreeFormat.get_formats`` deprecated in 2.4.0,
+  ``workingtree.WorkingTreeFormat.set_default_format`` deprecated in 2.4.0,
+  ``workingtree.WorkingTreeFormat.unregister_format`` deprecated in 2.4.0,
+  (Vincent Ladeuil)
+
 Internals
 *********
 



More information about the bazaar-commits mailing list