In the commit view, there is a category for "copied" which appears to be for file renames, but it doesn't work. File renames, even with 100% similarity, are treated as remove + add. We should detect renames and show diffs between the two files whenever possible. If it was a straight rename (100% similarity), a message indicating that should be displayed.
We plan to change
Commit.diffs
method to mark renamed files as copied.Now this method looks like this:
Allura/allura/model/repo.py:255
copied
list is always empty. To fill it we can check similarity between files inremoved
andadded
lists using difflib.SequenceMatcher. If similarity is more than some threshold (say 50%, like git default) we should treat such files as renamed and show diffs between them, or just show a message if it was a straight rename (100% similarity).For now we've got working code that implements this approach but it still dirty and needs some refactoring.
Ok
closed #141, branch - 42cc_3967