Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Apply failed hunk with TortoiseSVN

How can I apply a patch with TortoiseSVN that initially fails with one or more rejected hunks?

Is it possible to use TortoiseMerge to review the patch/the failed result and pick the lines I want to be applied?

If not, what do I do after I encounter failed hunks? Editing patch files by hand does not seem to be the perfect solution (apart from not knowing how to "fix" them)

like image 574
knittl Avatar asked Oct 09 '13 08:10

knittl


2 Answers

One way I can think of is:

  1. Switch the (clean) working copy to the base revision of the patch
  2. Apply the patch
  3. commit to a branch
  4. Switch to the trunk or your working branch, wherever you want to apply the patch.
  5. Perform a typical svn merge of the revision in (3) to your working copy.
like image 67
Yakov Galka Avatar answered Nov 06 '22 07:11

Yakov Galka


I ended up using the built-in Visual Studio merge tool as described here: Compare two files in Visual Studio 2012. I like the Visual Studio diff tool better than TortoiseSVN's anyway.

You still need another branch/trunk to apply the patch to but this way you don't need to commit it first.

  1. Switch the (clean) working copy to the base revision of the patch
  2. Apply the patch
  3. Use one of the methods described in that link to compare the files.
like image 3
user1568891 Avatar answered Nov 06 '22 07:11

user1568891