+ def diff_tree_files(self, t1, t2):
+ """Given two L{Tree}s C{t1} and C{t2}, iterate over all files for
+ which they differ. For each file, yield a tuple with the old
+ file mode, the new file mode, the old blob, the new blob, the
+ status, the old filename, and the new filename. Except in case
+ of a copy or a rename, the old and new filenames are
+ identical."""
+ assert isinstance(t1, Tree)
+ assert isinstance(t2, Tree)
+ i = iter(self.run(['git', 'diff-tree', '-r', '-z'] + [t1.sha1, t2.sha1]
+ ).raw_output().split('\0'))
+ try:
+ while True:
+ x = i.next()
+ if not x:
+ continue
+ omode, nmode, osha1, nsha1, status = x[1:].split(' ')
+ fn1 = i.next()
+ if status[0] in ['C', 'R']:
+ fn2 = i.next()
+ else:
+ fn2 = fn1
+ yield (omode, nmode, self.get_blob(osha1),
+ self.get_blob(nsha1), status, fn1, fn2)
+ except StopIteration:
+ pass