Apply seems to unapply hunks

Wouter Van Hemel wouter-kde at publica.duodecim.org
Fri Feb 25 15:02:00 CET 2011


Hello,

I'm a bit confused by the Kompare interface. It seems to reversely apply patches by default.

Given the following command line:

# kompare old_version.c new_version.c

If I use the "Apply Difference" or "Apply All", basically Kompare seems to undo the differences from new_version.c, so new_version.c ends up being old_version.c. I don't understand the logic. I would expect old_version.c to be updated to new_version.c by using "Apply" instead of undo'ing what's new in new_version.c; isn't the point of a patch usually to go from file1 to file2 instead of reversing the changes in file2 so file2 ends up being the older file1? Wouldn't it be more useful having "Apply Difference" selectively apply the difference to file1 so it gets updated to file2?

The same problem with:

# kompare test.diff

(with:
  --- oldfile
  +++ newfile
)

Applying the hunks in Kompare actually undoes from newfile to make it like oldfile, which is a reverse patch. I would expect clicking "Apply All" to apply the hunks to oldfile so I end up with newfile, but instead newfile ends up being oldfile. I expect "Apply Difference" to then selectively apply hunks from the patch to oldfile, moving towards newfile, which seems way more useful than the current behaviour.

Am I an idiot understanding the logic of these "Apply" functions in the Kompare GUI wrong, or did I somehow set a "reverse patch" option without noticing?


Thanks,

  Wouter




More information about the Kompare-devel mailing list