[MERGE][bug 103870] 'show_diff_trees' should handle a modified file in a renamed directory

John Arbash Meinel john at arbash-meinel.com
Wed Apr 11 23:14:25 BST 2007


We had a latent bug that was exposed by dirstate:
https://bugs.launchpad.net/bzr/+bug/103870

Basically, if you modify a file, and rename the directory it is in, we
were using the new path for the old tree, even though the full path has
effectively changed.

Early on we made the decision that children of a renamed directory
wouldn't show up as renamed, because it clutters the output. But the
diff itself (IMO) should show the correct path.

So in the old code (and WT3) if you did:

bzr init
mkdir dir
touch dir/file
bzr add
bzr commit -m "one"
bzr mv dir new
echo foo >> new/file
bzr diff

It would show:

=== renamed 'dir' => 'new'
=== modified 'new/file'
--- new/file
+++ new/file
+ foo


(With dirstate it would fail because it would lookup by path instead of
file id, and 'new/file' doesn't exist in the old tree)

With my patch it changes to:
=== renamed 'dir' => 'new'
=== modified 'new/file'
--- dir/file
+++ new/file
+ foo

Which I think is more correct, and it doesn't fail on dirstate :)

John
=:->

PS> And I added a few more direct tests of 'show_diff_trees' which
didn't have many direct tests.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: diff_renamed_103870.patch
Url: https://lists.ubuntu.com/archives/bazaar/attachments/20070411/24358c05/attachment-0001.diff 


More information about the bazaar mailing list