Browse Source

Remove some long deprecated methods on Repo.

Jelmer Vernooij 11 years ago
parent
commit
b772dfa92e
3 changed files with 5 additions and 112 deletions
  1. 5 0
      NEWS
  2. 0 48
      dulwich/repo.py
  3. 0 64
      dulwich/tests/test_repository.py

+ 5 - 0
NEWS

@@ -4,6 +4,11 @@
 
  * Drop support for Python 2.4 and 2.5. (Jelmer Vernooij)
 
+ API CHANGES
+
+ * Remove long deprecated ``Repo.commit``, ``Repo.get_blob``,
+   ``Repo.tree`` and ``Repo.tag``. (Jelmer Vernooij)
+
 0.9.4	2013-11-30
 
  IMPROVEMENTS

+ 0 - 48
dulwich/repo.py

@@ -372,54 +372,6 @@ class BaseRepo(object):
         backends = [self.get_config()] + StackedConfig.default_backends()
         return StackedConfig(backends, writable=backends[0])
 
-    def commit(self, sha):
-        """Retrieve the commit with a particular SHA.
-
-        :param sha: SHA of the commit to retrieve
-        :raise NotCommitError: If the SHA provided doesn't point at a Commit
-        :raise KeyError: If the SHA provided didn't exist
-        :return: A `Commit` object
-        """
-        warnings.warn("Repo.commit(sha) is deprecated. Use Repo[sha] instead.",
-            category=DeprecationWarning, stacklevel=2)
-        return self._get_object(sha, Commit)
-
-    def tree(self, sha):
-        """Retrieve the tree with a particular SHA.
-
-        :param sha: SHA of the tree to retrieve
-        :raise NotTreeError: If the SHA provided doesn't point at a Tree
-        :raise KeyError: If the SHA provided didn't exist
-        :return: A `Tree` object
-        """
-        warnings.warn("Repo.tree(sha) is deprecated. Use Repo[sha] instead.",
-            category=DeprecationWarning, stacklevel=2)
-        return self._get_object(sha, Tree)
-
-    def tag(self, sha):
-        """Retrieve the tag with a particular SHA.
-
-        :param sha: SHA of the tag to retrieve
-        :raise NotTagError: If the SHA provided doesn't point at a Tag
-        :raise KeyError: If the SHA provided didn't exist
-        :return: A `Tag` object
-        """
-        warnings.warn("Repo.tag(sha) is deprecated. Use Repo[sha] instead.",
-            category=DeprecationWarning, stacklevel=2)
-        return self._get_object(sha, Tag)
-
-    def get_blob(self, sha):
-        """Retrieve the blob with a particular SHA.
-
-        :param sha: SHA of the blob to retrieve
-        :raise NotBlobError: If the SHA provided doesn't point at a Blob
-        :raise KeyError: If the SHA provided didn't exist
-        :return: A `Blob` object
-        """
-        warnings.warn("Repo.get_blob(sha) is deprecated. Use Repo[sha] "
-            "instead.", category=DeprecationWarning, stacklevel=2)
-        return self._get_object(sha, Blob)
-
     def get_peeled(self, ref):
         """Get the peeled value of a ref.
 

+ 0 - 64
dulwich/tests/test_repository.py

@@ -179,53 +179,6 @@ class RepositoryTests(TestCase):
         r = self._repo = open_repo('a.git')
         self.assertFalse("bar" in r)
 
-    def test_commit(self):
-        r = self._repo = open_repo('a.git')
-        warnings.simplefilter("ignore", DeprecationWarning)
-        self.addCleanup(warnings.resetwarnings)
-        obj = r.commit(r.head())
-        self.assertEqual(obj.type_name, 'commit')
-
-    def test_commit_not_commit(self):
-        r = self._repo = open_repo('a.git')
-        warnings.simplefilter("ignore", DeprecationWarning)
-        self.addCleanup(warnings.resetwarnings)
-        self.assertRaises(errors.NotCommitError,
-            r.commit, '4f2e6529203aa6d44b5af6e3292c837ceda003f9')
-
-    def test_tree(self):
-        r = self._repo = open_repo('a.git')
-        commit = r[r.head()]
-        warnings.simplefilter("ignore", DeprecationWarning)
-        self.addCleanup(warnings.resetwarnings)
-        tree = r.tree(commit.tree)
-        self.assertEqual(tree.type_name, 'tree')
-        self.assertEqual(tree.sha().hexdigest(), commit.tree)
-
-    def test_tree_not_tree(self):
-        r = self._repo = open_repo('a.git')
-        warnings.simplefilter("ignore", DeprecationWarning)
-        self.addCleanup(warnings.resetwarnings)
-        self.assertRaises(errors.NotTreeError, r.tree, r.head())
-
-    def test_tag(self):
-        r = self._repo = open_repo('a.git')
-        tag_sha = '28237f4dc30d0d462658d6b937b08a0f0b6ef55a'
-        warnings.simplefilter("ignore", DeprecationWarning)
-        self.addCleanup(warnings.resetwarnings)
-        tag = r.tag(tag_sha)
-        self.assertEqual(tag.type_name, 'tag')
-        self.assertEqual(tag.sha().hexdigest(), tag_sha)
-        obj_class, obj_sha = tag.object
-        self.assertEqual(obj_class, objects.Commit)
-        self.assertEqual(obj_sha, r.head())
-
-    def test_tag_not_tag(self):
-        r = self._repo = open_repo('a.git')
-        warnings.simplefilter("ignore", DeprecationWarning)
-        self.addCleanup(warnings.resetwarnings)
-        self.assertRaises(errors.NotTagError, r.tag, r.head())
-
     def test_get_peeled(self):
         # unpacked ref
         r = self._repo = open_repo('a.git')
@@ -245,23 +198,6 @@ class RepositoryTests(TestCase):
         r = self._repo = open_repo('a.git')
         self.assertEqual(r.get_peeled('HEAD'), r.head())
 
-    def test_get_blob(self):
-        r = self._repo = open_repo('a.git')
-        commit = r[r.head()]
-        tree = r[commit.tree]
-        blob_sha = tree.items()[0][2]
-        warnings.simplefilter("ignore", DeprecationWarning)
-        self.addCleanup(warnings.resetwarnings)
-        blob = r.get_blob(blob_sha)
-        self.assertEqual(blob.type_name, 'blob')
-        self.assertEqual(blob.sha().hexdigest(), blob_sha)
-
-    def test_get_blob_notblob(self):
-        r = self._repo = open_repo('a.git')
-        warnings.simplefilter("ignore", DeprecationWarning)
-        self.addCleanup(warnings.resetwarnings)
-        self.assertRaises(errors.NotBlobError, r.get_blob, r.head())
-
     def test_get_walker(self):
         r = self._repo = open_repo('a.git')
         # include defaults to [r.head()]