gibuu is hosted by Hepforge, IPPP Durham
GiBUU

Changes between Initial Version and Version 1 of HowtoPatches


Ignore:
Timestamp:
Jun 29, 2012, 1:45:23 PM (12 years ago)
Author:
jweil
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • HowtoPatches

    v1 v1  
     1= Handling Patches =
     2
     3Patches are a useful concept for handling local code modifications. They can be handy e.g. for transferring changes from one branch to another (or from one computer to another).
     4
     5== 1) Producing a patch ==
     6
     7A patch is a file which contains code modifications in "diff" format. You can easily write all local modifications in an svn working copy to a file by doing:
     8
     9{{{
     10svn diff > patch.diff
     11}}}
     12
     13This will produce a file called 'patch.diff' which contains all the changes. If you only want the changes from specific files or directories, you can do:
     14
     15{{{
     16svn diff someDir/ someFile.f90 > patch.diff
     17}}}
     18
     19If you want to produce a patch of a certain revision (let's say rev. 1234) in an svn repository, you can do:
     20
     21{{{
     22svn diff -c1234 > patch.diff
     23}}}
     24
     25This will include all changes made in that particular revision. If you want a patch of all modifications in a given range of revisions, do:
     26
     27{{{
     28svn diff -r1234:5678 > patch.diff
     29}}}
     30
     31This will include the modifications of all revisions after 1234 up to (and including) 5678. The changes of revision 1234 will not be included.
     32
     33== 2) Applying a patch ==
     34
     35Once you have a patch file, you can apply it e.g. to another svn branch (or even to a directory which is not under version control). This is done via:
     36
     37{{{
     38patch -p0 < patch.diff
     39}}}
     40
     41This will apply the changes from the patch file to the current directory.