git-cola/git-cola — pull request #329 by living180 (2014-07-22 15:27:11+00:00)
Title: Improve revert lines

The process used for generating reverse diffs for operations such as "Revert Selected Lines..." sometimes resulted in the wrong lines being reverted. The process worked as follows:

* call out to git to generate the full forward and reverse diffs for the file
* find the text from the GUI selection in the full forward diff
* use the information about the location of the GUI selection in the forward diff to determine which lines to use from the reverse diff
* generate the partial reverse diff from those lines

The problem with this is that if there are adjacent adds and removes, the order of lines in the forward diff will likely not be the same as in the reverse diff. As a result, the wrong lines can be selected from the reverse diff.

To address this issue, change the code to no longer use git to get the full reverse diff. Instead, transform the full forward diff to a reverse diff algorithmically.