[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[jgit-dev] rename detection working
|
Folks, we now have rename detection in JGit. Its working pretty
well already. It could be faster, blah blah blah, but it seems
pretty solid thus far.
For example:
$ jgit log --name-status --follow builtin/fsck.c | grep ^R
R100 builtin-fsck.c builtin/fsck.c
R099 fsck.c builtin-fsck.c
R099 fsck-objects.c fsck.c
R099 fsck-cache.c fsck-objects.c
:-)
The code to use it is pretty simple. Assuming you already have a
properly configured TreeWalk for the difference you want to view:
RenameDetector rd = new RenameDetector(repository);
rd.addAll(DiffEntry.scan(tw));
List<DiffEntry> files = rd.compute();
And then traverse over that file set. Since compute can be very
long running (due to the O(N^2) nature of the rename algorithm),
you can also pass it a ProgressMonitor.
Patches are on Gerrit pending review. Some major highlights from
the series are:
http://egit.eclipse.org/r/1048 : bulk of the rename detector
http://egit.eclipse.org/r/1055 : log --follow
--
Shawn.