Work around MyersDiff infinite loop in PatchListLoader

This infinite loop is happening for some files when the PatchListLoader
is computing the differences between 2 commits. It first showed up[1] in
the mergeability checks done in background and was easy to work around
by killing the thread using Javamelody and abandoning the faulty commits.

The issue showed up again, when upgrading from 2.9.x to 2.10: the online
reindexer getting stuck because of that infinite loop and this time, no
easy work around.

Use a similar approach that was done in intraline diff to work around
the MyersDiff infinite loop. Instead of returning a timeout error
message when the infinite loop is detected, fallback to a diff algorithm
that does not use MyersDiff. Returning a timeout error was not an option
because the failing operation is not always triggered by a user.

From the user perspective, the only difference when the infinite loop
is detected is that the files in the commit will not be compared
in-depth, which will result in bigger edit regions.

[1]https://groups.google.com/d/msg/repo-discuss/ZtiCilM3wFA/LijfZ4YkLHsJ

Change-Id: Ib00de070dd8df1722d4ade0a83c0ffa8eaa37f8e
5 files changed