@@ -91,15 +91,15 @@ class DiffDirtyTest(utils.DirtyRepoTestCase):
9191 def test_diff_empty_index (self ):
9292 repo = self .repo
9393 head = repo [repo .lookup_reference ('HEAD' ).resolve ().target ]
94- diff = head .tree .diff (repo .index )
94+ diff = head .tree .diff_to_index (repo .index )
9595
9696 files = [patch .new_file_path for patch in diff ]
9797 self .assertEqual (DIFF_INDEX_EXPECTED , files )
9898
9999 def test_workdir_to_tree (self ):
100100 repo = self .repo
101101 head = repo [repo .lookup_reference ('HEAD' ).resolve ().target ]
102- diff = head .tree .diff ()
102+ diff = head .tree .diff_to_workdir ()
103103
104104 files = [patch .new_file_path for patch in diff ]
105105 self .assertEqual (DIFF_WORKDIR_EXPECTED , files )
@@ -110,12 +110,13 @@ class DiffTest(utils.BareRepoTestCase):
110110 def test_diff_invalid (self ):
111111 commit_a = self .repo [COMMIT_SHA1_1 ]
112112 commit_b = self .repo [COMMIT_SHA1_2 ]
113- self .assertRaises (TypeError , commit_a .tree .diff , commit_b )
113+ self .assertRaises (TypeError , commit_a .tree .diff_to_tree , commit_b )
114+ self .assertRaises (TypeError , commit_a .tree .diff_to_index , commit_b )
114115
115116 def test_diff_empty_index (self ):
116117 repo = self .repo
117118 head = repo [repo .lookup_reference ('HEAD' ).resolve ().target ]
118- diff = head .tree .diff (repo .index )
119+ diff = head .tree .diff_to_index (repo .index )
119120
120121 files = [patch .new_file_path .split ('/' )[0 ] for patch in diff ]
121122 self .assertEqual ([x .name for x in head .tree ], files )
@@ -124,7 +125,7 @@ def test_diff_tree(self):
124125 commit_a = self .repo [COMMIT_SHA1_1 ]
125126 commit_b = self .repo [COMMIT_SHA1_2 ]
126127
127- diff = commit_a .tree .diff (commit_b .tree )
128+ diff = commit_a .tree .diff_to_tree (commit_b .tree )
128129
129130 # self.assertIsNotNone is 2.7 only
130131 self .assertTrue (diff is not None )
@@ -143,7 +144,7 @@ def test_diff_tree(self):
143144
144145 def test_diff_empty_tree (self ):
145146 commit_a = self .repo [COMMIT_SHA1_1 ]
146- diff = commit_a .tree .diff ( empty_tree = True )
147+ diff = commit_a .tree .diff_to_tree ( )
147148 entries = [p .new_file_path for p in diff ]
148149 self .assertAll (lambda x : commit_a .tree [x ], entries )
149150
@@ -153,11 +154,11 @@ def test_diff_tree_opts(self):
153154
154155 for opt in [pygit2 .GIT_DIFF_IGNORE_WHITESPACE ,
155156 pygit2 .GIT_DIFF_IGNORE_WHITESPACE_EOL ]:
156- diff = commit_c .tree .diff (commit_d .tree , opt )
157+ diff = commit_c .tree .diff_to_tree (commit_d .tree , opt )
157158 self .assertTrue (diff is not None )
158159 self .assertEqual (0 , len (diff [0 ].hunks ))
159160
160- diff = commit_c .tree .diff (commit_d .tree )
161+ diff = commit_c .tree .diff_to_tree (commit_d .tree )
161162 self .assertTrue (diff is not None )
162163 self .assertEqual (1 , len (diff [0 ].hunks ))
163164
@@ -166,11 +167,11 @@ def test_diff_merge(self):
166167 commit_b = self .repo [COMMIT_SHA1_2 ]
167168 commit_c = self .repo [COMMIT_SHA1_3 ]
168169
169- diff_b = commit_a .tree .diff (commit_b .tree )
170+ diff_b = commit_a .tree .diff_to_tree (commit_b .tree )
170171 # self.assertIsNotNone is 2.7 only
171172 self .assertTrue (diff_b is not None )
172173
173- diff_c = commit_b .tree .diff (commit_c .tree )
174+ diff_c = commit_b .tree .diff_to_tree (commit_c .tree )
174175 # self.assertIsNotNone is 2.7 only
175176 self .assertTrue (diff_c is not None )
176177
@@ -197,13 +198,13 @@ def test_diff_patch(self):
197198 commit_a = self .repo [COMMIT_SHA1_1 ]
198199 commit_b = self .repo [COMMIT_SHA1_2 ]
199200
200- diff = commit_a .tree .diff (commit_b .tree )
201+ diff = commit_a .tree .diff_to_tree (commit_b .tree )
201202 self .assertEqual (diff .patch , PATCH )
202203
203204 def test_diff_oids (self ):
204205 commit_a = self .repo [COMMIT_SHA1_1 ]
205206 commit_b = self .repo [COMMIT_SHA1_2 ]
206- patch = commit_a .tree .diff (commit_b .tree )[0 ]
207+ patch = commit_a .tree .diff_to_tree (commit_b .tree )[0 ]
207208 self .assertEqual (patch .old_oid ,
208209 '7f129fd57e31e935c6d60a0c794efe4e6927664b' )
209210 self .assertEqual (patch .new_oid ,
@@ -212,7 +213,7 @@ def test_diff_oids(self):
212213 def test_hunk_content (self ):
213214 commit_a = self .repo [COMMIT_SHA1_1 ]
214215 commit_b = self .repo [COMMIT_SHA1_2 ]
215- patch = commit_a .tree .diff (commit_b .tree )[0 ]
216+ patch = commit_a .tree .diff_to_tree (commit_b .tree )[0 ]
216217 hunk = patch .hunks [0 ]
217218 lines = ('{0} {1}' .format (* x ) for x in hunk .lines )
218219 self .assertEqual (HUNK_EXPECTED , '' .join (lines ))
@@ -223,7 +224,8 @@ def test_find_similar(self):
223224
224225 #~ Must pass GIT_DIFF_INCLUDE_UNMODIFIED if you expect to emulate
225226 #~ --find-copies-harder during rename transformion...
226- diff = commit_a .tree .diff (commit_b .tree , GIT_DIFF_INCLUDE_UNMODIFIED )
227+ diff = commit_a .tree .diff_to_tree (commit_b .tree ,
228+ GIT_DIFF_INCLUDE_UNMODIFIED )
227229 self .assertAll (lambda x : x .status != 'R' , diff )
228230 diff .find_similar ()
229231 self .assertAny (lambda x : x .status == 'R' , diff )
0 commit comments