Browse Source

Rename Index.iterblobs to Index.iterobjects.

Jelmer Vernooij 7 years ago
parent
commit
18c32466b5
2 changed files with 13 additions and 3 deletions
  1. 5 0
      NEWS
  2. 8 3
      dulwich/index.py

+ 5 - 0
NEWS

@@ -5,6 +5,11 @@
   * Add 'dulwich.mailmap' file for reading mailmap files.
     (Jelmer Vernooij)
 
+ API CHANGES
+
+  * Index.iterblobs has been renamed to Index.iterobjects.
+   (Jelmer Vernooij)
+
 0.19.0	2018-03-10
 
  BUG FIXES

+ 8 - 3
dulwich/index.py

@@ -267,12 +267,17 @@ class Index(object):
         """Return the POSIX file mode for the object at a path."""
         return self[path].mode
 
-    def iterblobs(self):
+    def iterobjects(self):
         """Iterate over path, sha, mode tuples for use with commit_tree."""
         for path in self:
             entry = self[path]
             yield path, entry.sha, cleanup_mode(entry.mode)
 
+    def iterblobs(self):
+        import warnings
+        warnings.warn(PendingDeprecationWarning, 'Use iterobjects() instead.')
+        return self.iterblobs()
+
     def clear(self):
         """Remove all contents from this index."""
         self._byname = {}
@@ -317,7 +322,7 @@ class Index(object):
         :param object_store: Object store to save the tree in
         :return: Root tree SHA
         """
-        return commit_tree(object_store, self.iterblobs())
+        return commit_tree(object_store, self.iterobjects())
 
 
 def commit_tree(object_store, blobs):
@@ -368,7 +373,7 @@ def commit_index(object_store, index):
     :note: This function is deprecated, use index.commit() instead.
     :return: Root tree sha.
     """
-    return commit_tree(object_store, index.iterblobs())
+    return commit_tree(object_store, index.iterobjects())
 
 
 def changes_from_tree(names, lookup_entry, object_store, tree,