Repo.get_blob, Repo.commit, Repo.tag and Repo.tree are now deprecated.
authorJelmer Vernooij <jelmer@samba.org>
Mon, 29 Mar 2010 11:01:49 +0000 (13:01 +0200)
committerJelmer Vernooij <jelmer@samba.org>
Mon, 29 Mar 2010 11:01:49 +0000 (13:01 +0200)
NEWS
dulwich/repo.py

diff --git a/NEWS b/NEWS
index 03bd44ec1481867f71e55fb998c24ab74c7e1bbe..345bc85db61891a4041a8d57d956ead1b0e02b2b 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -26,6 +26,9 @@
   * The 'committer' and 'message' arguments to Repo.do_commit() have 
     been swapped. 'committer' is now optional. (Jelmer Vernooij)
 
+  * Repo.get_blob, Repo.commit, Repo.tag and Repo.tree are now deprecated.
+    (Jelmer Vernooij)
+
 0.5.0  2010-03-03
 
  BUG FIXES
index 388e0d43d45b49696d7fed85b5100f070c75569f..c6397fbc54e6af9a4759c6b63a9956d8685c7de7 100644 (file)
@@ -51,6 +51,8 @@ from dulwich.objects import (
     hex_to_sha,
     num_type_map,
     )
+import warnings
+
 
 OBJECTDIR = 'objects'
 SYMREF = 'ref: '
@@ -730,6 +732,8 @@ class BaseRepo(object):
         :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, level=2)
         return self._get_object(sha, Commit)
 
     def tree(self, sha):
@@ -740,6 +744,8 @@ class BaseRepo(object):
         :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)
         return self._get_object(sha, Tree)
 
     def tag(self, sha):
@@ -750,6 +756,8 @@ class BaseRepo(object):
         :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)
         return self._get_object(sha, Tag)
 
     def get_blob(self, sha):
@@ -760,6 +768,8 @@ class BaseRepo(object):
         :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)
         return self._get_object(sha, Blob)
 
     def get_peeled(self, ref):