[KompareDiff2 Library]: Fix issues with blending diffs with files or folders
AbandonedPublic

Authored by jsalatas on Mar 19 2017, 10:25 PM.

Details

Reviewers
whiting
kkofler
Summary

There seem to be several issues when blending diffs with files or folders. This patch does the following:

  • Adjust the depth in order to get the correct filename to use for blending (see method adjustDepthInPath).
  • Before blending check if the hunk applies cleanly and if not raise an error.
Test Plan
  • Compiles, runs and does what it is supposed to do.
  • KDevelop's patch review works also.
  • Test with both local and remote (fish protocol) files/folders

Notice that there also seems to be an issue with saving files (not only in blending but also in comparing files/folders) and I'm planning to create another review to address it.

Diff Detail

Repository
R455 KompareDiff2 Library
Lint
Lint Skipped
Unit
Unit Tests Skipped
jsalatas created this revision.Mar 19 2017, 10:25 PM
kkofler edited edge metadata.Mar 22 2017, 9:48 AM

Unfortunately, I don't think your approach at taking the common part of source and destination as the directory and file name is going to work in all cases:

  • If a file was added or removed, the source resp. destination will be /dev/null.
  • Some revision control systems track renames and moves and output them as a diff section with different source and destination.
kkofler added a comment.EditedMar 22 2017, 9:51 AM

And also, you are again trying to fix 2 bugs in one review request. Please submit one review per issue you fix.

And also, you are again trying to fix 2 bugs in one review request. Please submit one review per issue you fix.

Hmmm..... the problem is here is that the two issues here are intertwined and trying to see if the hunk applies cleanly is meaningless if the code can't locate the file.

In any case, I will submit two separate reviews.....

Unfortunately, I don't think your approach at taking the common part of source and destination as the directory and file name is going to work in all cases:

Hmmm..... you are right. Actually the correct solution would be to use the m_info->depth so that it would hopefully handled by the method setDepthAndApplied. However, as this option (depth) should be provided by the user, it would require an additional parameter in kompareinterface.h in methods openFileAndDiff and openDirAndDiff, which would break binary compatibility of "Kompare/ViewPart". So I'm just trying to guess here which as you suggested wouldn't work in all cases.

I would appreciate your feedback in this.

  • Some revision control systems track renames and moves and output them as a diff section with different source and destination.

I'm not aware of such RCS. :\ Could you please provide an example?

Well, I think that in the present case, a single review is acceptable, but it needs to work in all situations. Unfortunately, I don't think your current code satisfies this requirement.

jsalatas abandoned this revision.Mar 22 2017, 8:45 PM

Will recheck and create a new one....