Merge lp:~jelmer/dulwich/deprecate-tree-entries into lp:~vcs-imports/dulwich/trunk

Proposed by Jelmer Vernooij
Status: Merged
Merge reported by: Jelmer Vernooij
Merged at revision: not available
Proposed branch: lp:~jelmer/dulwich/deprecate-tree-entries
Merge into: lp:~vcs-imports/dulwich/trunk
Diff against target: 70 lines (+12/-4)
5 files modified
NEWS (+5/-0)
dulwich/object_store.py (+1/-1)
dulwich/objects.py (+3/-0)
dulwich/tests/test_objects.py (+2/-2)
dulwich/tests/test_repository.py (+1/-1)
To merge this branch: bzr merge lp:~jelmer/dulwich/deprecate-tree-entries
Reviewer Review Type Date Requested Status
VCS imports Pending
Review via email: mp+53177@code.launchpad.net

Description of the change

Deprecated Tree.entries(), which returns entries in an unusual format
(mode, name, hexsha). Tree.iteritems() / Tree.items() should be used
instead and have been available for some time.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'NEWS'
2--- NEWS 2011-03-06 03:48:23 +0000
3+++ NEWS 2011-03-13 16:57:53 +0000
4@@ -16,6 +16,11 @@
5
6 * Sphinxified documentation. (Lukasz Balcerzak)
7
8+ API CHANGES
9+
10+ * Tree.entries() is now deprecated in favour of Tree.items() and
11+ Tree.iteritems(). (Jelmer Vernooij)
12+
13 0.7.0 2011-01-21
14
15 FEATURES
16
17=== modified file 'dulwich/object_store.py'
18--- dulwich/object_store.py 2011-03-06 03:48:23 +0000
19+++ dulwich/object_store.py 2011-03-13 16:57:53 +0000
20@@ -698,7 +698,7 @@
21
22 def parse_tree(self, tree):
23 self.add_todo([(sha, name, not stat.S_ISDIR(mode))
24- for mode, name, sha in tree.entries()
25+ for name, mode, sha in tree.iteritems()
26 if not S_ISGITLINK(mode)])
27
28 def parse_commit(self, commit):
29
30=== modified file 'dulwich/objects.py'
31--- dulwich/objects.py 2011-03-06 03:48:23 +0000
32+++ dulwich/objects.py 2011-03-13 16:57:53 +0000
33@@ -838,6 +838,9 @@
34 returned by the items and iteritems methods. This function will be
35 deprecated in the future.
36 """
37+ warnings.warn("Tree.entries() is deprecated. Use Tree.items() or"
38+ " Tree.iteritems() instead.", category=DeprecationWarning,
39+ stacklevel=2)
40 self._ensure_parsed()
41 # The order of this is different from iteritems() for historical
42 # reasons
43
44=== modified file 'dulwich/tests/test_objects.py'
45--- dulwich/tests/test_objects.py 2010-12-19 15:56:03 +0000
46+++ dulwich/tests/test_objects.py 2011-03-13 16:57:53 +0000
47@@ -150,8 +150,8 @@
48
49 def test_read_tree_from_file(self):
50 t = self.get_tree(tree_sha)
51- self.assertEqual(t.entries()[0], (33188, 'a', a_sha))
52- self.assertEqual(t.entries()[1], (33188, 'b', b_sha))
53+ self.assertEqual(t.items()[0], ('a', 33188, a_sha))
54+ self.assertEqual(t.items()[1], ('b', 33188, b_sha))
55
56 def test_read_tag_from_file(self):
57 t = self.get_tag(tag_sha)
58
59=== modified file 'dulwich/tests/test_repository.py'
60--- dulwich/tests/test_repository.py 2011-01-17 06:00:40 +0000
61+++ dulwich/tests/test_repository.py 2011-03-13 16:57:53 +0000
62@@ -239,7 +239,7 @@
63 r = self._repo = open_repo('a.git')
64 commit = r[r.head()]
65 tree = r[commit.tree]
66- blob_sha = tree.entries()[0][2]
67+ blob_sha = tree.items()[0][2]
68 warnings.simplefilter("ignore", DeprecationWarning)
69 try:
70 blob = r.get_blob(blob_sha)

Subscribers

People subscribed via source and target branches