Rev 2408: Do a better fix, which recognizes that we should pass the correct old path. in http://bzr.arbash-meinel.com/branches/bzr/0.16-dev/diff_renamed_103870
John Arbash Meinel
john at arbash-meinel.com
Wed Apr 11 23:05:35 BST 2007
At http://bzr.arbash-meinel.com/branches/bzr/0.16-dev/diff_renamed_103870
------------------------------------------------------------
revno: 2408
revision-id: john at arbash-meinel.com-20070411220516-bz4941rayeilvjac
parent: john at arbash-meinel.com-20070411220215-o07i1rcajpghkpom
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: diff_renamed_103870
timestamp: Wed 2007-04-11 17:05:16 -0500
message:
Do a better fix, which recognizes that we should pass the correct old path.
modified:
bzrlib/diff.py diff.py-20050309040759-26944fbbf2ebbf36
bzrlib/tests/test_diff.py testdiff.py-20050727164403-d1a3496ebb12e339
-------------- next part --------------
=== modified file 'bzrlib/diff.py'
--- a/bzrlib/diff.py 2007-04-11 22:02:15 +0000
+++ b/bzrlib/diff.py 2007-04-11 22:05:16 +0000
@@ -471,11 +471,11 @@
has_changes = 1
prop_str = get_prop_change(meta_modified)
print >>to_file, '=== modified %s %r%s' % (kind, path.encode('utf8'), prop_str)
- # The path may not be correct in the case that the containing directory
- # was renamed. So don't pass it to _patch_header_date, which passes it
- # to tree.get_file_mtime()
- old_name = '%s%s\t%s' % (old_label, path,
- _patch_header_date(old_tree, file_id, None))
+ # The file may be in a different location in the old tree (because
+ # the containing dir was renamed, but the file itself was not)
+ old_path = old_tree.id2path(file_id)
+ old_name = '%s%s\t%s' % (old_label, old_path,
+ _patch_header_date(old_tree, file_id, old_path))
new_name = '%s%s\t%s' % (new_label, path,
_patch_header_date(new_tree, file_id, path))
if text_modified:
=== modified file 'bzrlib/tests/test_diff.py'
--- a/bzrlib/tests/test_diff.py 2007-04-11 22:02:15 +0000
+++ b/bzrlib/tests/test_diff.py 2007-04-11 22:05:16 +0000
@@ -392,7 +392,7 @@
self.assertContainsRe(diff, "=== modified file 'other/file'\n")
# XXX: This is technically incorrect, because it used to be at another
# location. What to do?
- self.assertContainsRe(diff, '--- old/other/file\t')
+ self.assertContainsRe(diff, '--- old/dir/file\t')
self.assertContainsRe(diff, '\\+\\+\\+ new/other/file\t')
self.assertContainsRe(diff, '-contents\n'
'\\+new contents\n')
More information about the bazaar-commits
mailing list