Comment 7 for bug 103870

Revision history for this message
John A Meinel (jameinel) wrote :

This is actually a latent bug in the current 'diff' codebase.

The reason we didn't experience it until DirState is because the old 'get_file_mtime()' for older trees ignored the 'path' parameter, and only used the file-id.

What is happening is that the 'diff' code passes both a 'file_id' and a 'path' to find the modification time of a file.

And what is happening is that the current path for the file is not the same as the old path. But it doesn't show up as a 'rename' because the directory was renamed, not the file itself.

The fix is to not give the 'path' hint, when we can't be fully sure that it really is the path:

=== modified file 'bzrlib/diff.py'
--- bzrlib/diff.py 2007-03-13 02:16:17 +0000
+++ bzrlib/diff.py 2007-04-11 21:27:57 +0000
@@ -472,7 +472,7 @@
         prop_str = get_prop_change(meta_modified)
         print >>to_file, '=== modified %s %r%s' % (kind, path.encode('utf8'), prop_str)
         old_name = '%s%s\t%s' % (old_label, path,
- _patch_header_date(old_tree, file_id, path))
+ _patch_header_date(old_tree, file_id, None))
         new_name = '%s%s\t%s' % (new_label, path,
                                  _patch_header_date(new_tree, file_id, path))

I'll write some tests, and submit it to the mailing list.

In the mean time, the fix will be in the associated branch.