Implemented file path based tie breaking to exact rename detection
commit31311cacfd311f9a78bdf012a9f6ba1907b9964a
authorJeff Schumacher <jeffschu@google.com>
Tue, 13 Jul 2010 19:21:12 +0000 (13 12:21 -0700)
committerJeff Schumacher <jeffschu@google.com>
Fri, 16 Jul 2010 16:56:42 +0000 (16 09:56 -0700)
tree2f68c9b3af58ca0ffd1d96c05d49d8a64ebb2275
parentf666cc755b35a8f57a7c208c88230f7ab7c1d07b
Implemented file path based tie breaking to exact rename detection

During the exact rename detection phase in RenameDetector, ties were
resolved on a first-found basis. I added support for file path based
tie breaking during that phase. Basically, there are four situations
that have to be handled:

One add matching one delete:
In this simple case, we pair them as a rename.

One add matching many deletes:
Find the delete whos path matches the add the closest, and
pair them as a rename.

Many adds matching one delete:
Similar to the above case, we find the add that matches the
delete the closest, and pair them as a rename. The other adds
are marked as copies of the delete.

Many adds matching many deletes:
Build a scoring matrix similar to the one used for content-
based matching, scoring instead by file path. Some of the
utility functions in SimilarityRenameDetector are used in
this case, as we use the same encoding scheme. Once the
matrix is built, scan it for the best matches, marking them
as renames. The rest are marked as copies.

I don't particularly like the idea of using utility functions right
out of SimilarityRenameDetector, but it works for the moment. A later
commit will likely refactor this into a common utility class, as well
as bringing exact rename detection out of RenameDetector and into a
separate class, much like SimilarityRenameDetector.

Change-Id: I1fb08390aebdcbf20d049aecf402a36506e55611
org.eclipse.jgit.test/tst/org/eclipse/jgit/diff/RenameDetectorTest.java
org.eclipse.jgit/src/org/eclipse/jgit/diff/DiffEntry.java
org.eclipse.jgit/src/org/eclipse/jgit/diff/RenameDetector.java
org.eclipse.jgit/src/org/eclipse/jgit/diff/SimilarityRenameDetector.java