Jelmer Vernooij 11 роки тому
батько
коміт
fcad3368c6
3 змінених файлів з 7 додано та 0 видалено
  1. 3 0
      NEWS
  2. 3 0
      dulwich/repo.py
  3. 1 0
      dulwich/tests/test_repository.py

+ 3 - 0
NEWS

@@ -18,6 +18,9 @@
   * Remove long deprecated RefsContainer.set_ref().
     (Jelmer Vernooij)
 
+  * Repo.ref() is now deprecated in favour of Repo.refs[].
+    (Jelmer Vernooij)
+
 0.9.3	2013-09-27
 
  BUG FIXES

+ 3 - 0
dulwich/repo.py

@@ -224,6 +224,9 @@ class BaseRepo(object):
         :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):

+ 1 - 0
dulwich/tests/test_repository.py

@@ -117,6 +117,7 @@ class RepositoryTests(TestCase):
 
     def test_ref(self):
         r = self._repo = open_repo('a.git')
+        warnings.simplefilter("ignore", DeprecationWarning)
         self.assertEqual(r.ref('refs/heads/master'),
                          'a90fa2d900a17e99b433217e988c4eb4a2e9a097')