2
0
Эх сурвалжийг харах

Remove long deprecated Repo.ref and Repo.revision_history.

Jelmer Vernooij 11 жил өмнө
parent
commit
6471fb3222

+ 3 - 0
NEWS

@@ -9,6 +9,9 @@
  * Remove long deprecated ``Repo.commit``, ``Repo.get_blob``,
    ``Repo.tree`` and ``Repo.tag``. (Jelmer Vernooij)
 
+ * Remove long deprecated ``Repo.revision_history`` and ``Repo.ref``.
+   (Jelmer Vernooij)
+
 0.9.4	2013-11-30
 
  IMPROVEMENTS

+ 0 - 26
dulwich/repo.py

@@ -270,18 +270,6 @@ class BaseRepo(object):
             heads = self.refs.as_dict('refs/heads').values()
         return ObjectStoreGraphWalker(heads, self.get_parents)
 
-    def ref(self, name):
-        """Return the SHA1 a ref is pointing to.
-
-        :param name: Name of the ref to look up
-        :raise KeyError: when the ref (or the one it points to) does not exist
-        :return: SHA1 it is pointing at
-        """
-        warnings.warn(
-            "Repo.ref(name) is deprecated. Use Repo.refs[name] instead.",
-            category=DeprecationWarning, stacklevel=2)
-        return self.refs[name]
-
     def get_refs(self):
         """Get dictionary with all refs.
 
@@ -420,20 +408,6 @@ class BaseRepo(object):
 
         return Walker(self.object_store, include, *args, **kwargs)
 
-    def revision_history(self, head):
-        """Returns a list of the commits reachable from head.
-
-        :param head: The SHA of the head to list revision history for.
-        :return: A list of commit objects reachable from head, starting with
-            head itself, in descending commit time order.
-        :raise MissingCommitError: if any missing commits are referenced,
-            including if the head parameter isn't the SHA of a commit.
-        """
-        warnings.warn("Repo.revision_history() is deprecated."
-            "Use dulwich.walker.Walker(repo) instead.",
-            category=DeprecationWarning, stacklevel=2)
-        return [e.commit for e in self.get_walker(include=[head])]
-
     def __getitem__(self, name):
         """Retrieve a Git object by SHA1 or ref.
 

+ 0 - 23
dulwich/tests/test_repository.py

@@ -19,7 +19,6 @@
 
 """Tests for the repository."""
 
-from cStringIO import StringIO
 import os
 import stat
 import shutil
@@ -103,12 +102,6 @@ class RepositoryTests(TestCase):
         r = self._repo = open_repo('a.git')
         self.assertEqual(r.controldir(), r.path)
 
-    def test_ref(self):
-        r = self._repo = open_repo('a.git')
-        warnings.simplefilter("ignore", DeprecationWarning)
-        self.assertEqual(r.ref('refs/heads/master'),
-                         'a90fa2d900a17e99b433217e988c4eb4a2e9a097')
-
     def test_setitem(self):
         r = self._repo = open_repo('a.git')
         r["refs/tags/foo"] = 'a90fa2d900a17e99b433217e988c4eb4a2e9a097'
@@ -210,15 +203,6 @@ class RepositoryTests(TestCase):
             [e.commit.id for e in r.get_walker('2a72d929692c41d8554c07f6301757ba18a65d91')],
             ['2a72d929692c41d8554c07f6301757ba18a65d91'])
 
-    def test_linear_history(self):
-        r = self._repo = open_repo('a.git')
-        warnings.simplefilter("ignore", DeprecationWarning)
-        self.addCleanup(warnings.resetwarnings)
-        history = r.revision_history(r.head())
-        shas = [c.sha().hexdigest() for c in history]
-        self.assertEqual(shas, [r.head(),
-                                '2a72d929692c41d8554c07f6301757ba18a65d91'])
-
     def test_clone(self):
         r = self._repo = open_repo('a.git')
         tmp_dir = tempfile.mkdtemp()
@@ -276,13 +260,6 @@ class RepositoryTests(TestCase):
                                 '60dacdc733de308bb77bb76ce0fb0f9b44c9769e',
                                 '0d89f20333fbb1d2f3a94da77f4981373d8f4310'])
 
-    def test_revision_history_missing_commit(self):
-        r = self._repo = open_repo('simple_merge.git')
-        warnings.simplefilter("ignore", DeprecationWarning)
-        self.addCleanup(warnings.resetwarnings)
-        self.assertRaises(errors.MissingCommitError, r.revision_history,
-                          missing_sha)
-
     def test_out_of_order_merge(self):
         """Test that revision history is ordered by date, not parent order."""
         r = self._repo = open_repo('ooo_merge.git')