140
140
self.wt = self.make_branch_and_tree('.')
141
141
self.branch = self.wt.branch
142
142
print >> open('file', 'wb'), 'foo'
143
print >> open('binfile', 'wb'), 'foo'
143
144
self.wt.add(['file'], ['fileid'])
145
self.wt.add(['binfile'], ['binfileid'])
144
146
if has_symlinks():
145
147
os.symlink('target1', 'symlink')
146
148
self.wt.add(['symlink'], ['linkid'])
147
149
self.wt.commit('message_1', rev_id = '1')
148
150
print >> open('file', 'wb'), 'bar'
151
print >> open('binfile', 'wb'), 'x' * 1023 + '\x00'
149
152
if has_symlinks():
150
153
os.unlink('symlink')
151
154
os.symlink('target2', 'symlink')
152
155
self.tree_1 = self.branch.repository.revision_tree('1')
153
156
self.inv_1 = self.branch.repository.get_inventory('1')
154
157
self.file_1 = self.inv_1['fileid']
158
self.file_1b = self.inv_1['binfileid']
155
159
self.tree_2 = self.wt
156
160
self.inv_2 = self.tree_2.read_working_inventory()
157
161
self.file_2 = self.inv_2['fileid']
162
self.file_2b = self.inv_2['binfileid']
158
163
if has_symlinks():
159
164
self.link_1 = self.inv_1['linkid']
160
165
self.link_2 = self.inv_2['linkid']
204
def test_file_diff_binary(self):
206
self.file_1.diff(internal_diff,
207
"/dev/null", self.tree_1,
208
"new_label", self.file_2b, self.tree_2,
210
self.assertEqual(output.getvalue(),
211
"Binary files /dev/null and new_label differ\n")
199
212
def test_link_diff_deleted(self):
200
213
if not has_symlinks():