Apply patch to the code base from java code using any library like SVNKIT

433 views Asked by At

I have a patch file that needs to be applied in the working directory of codebase checked out using SVN. I need to write program to do this. Now I used SVNKIT jar to do (checkout from repository, updating code base, reverting any local changes). Now I could not figure out a way to apply a patch to the code base. Is there any way to do?

1

There are 1 answers

3
martoe On

With SVNKit, use the "doPatch(java.io.File, java.io.File, boolean, int)" method of the SVNDiffClient class:

Arguments:

  1. the source patch file
  2. the target directory
  3. "dryRun" - if "true", the patching process is carried out, and full notification feedback is provided, but the working copy is not modified
  4. "stripCount" - specifies how many leading path components should be stripped from paths obtained from the patch (usually "0")