Create "patch" between revisions?

29,268

Solution 1

This can be achieved in tortoise SVN itself. Right click on the branch(folder) from where you want to create the patch >> Show Log >> Select All the revisions for which you need to create the patch >> Right Click and select Compare revisions >> This will show the changed files >> Select all the files >> Right click and select Export Revision To >> Give any path in your machine >> The files will get exported in the respective folder structure.

Alternately you can achieve this via scripting. Refer the following link for that:

http://www.electrictoolbox.com/subversion-export-changed-files-cli

Solution 2

From the command line you could do this as follows.

All files in a folder

Create a patch in your Home folder that contains all the changes between revision 123 and 124 from all the changed files in the folder "my_project":

svn diff -r123:124 path/to/my_project > ~/my_project_changes_123_124.patch

One particular file

Create a patch in your Home folder that contains all the changes between revision 123 and 124 from only one file, name "my_project.php":

svn diff -r123:124 path/to/my_project/my_project.php > ~/my_project_changes_123_124.patch

Solution 3

Um...how about svn diff? Just pass it the desired revisions.

http://svnbook.red-bean.com/en/1.7/svn.ref.svn.c.diff.html

In TortoiseSVN, if you highlight the revisions you want in the "show log" dialog, there is even a context menu item to show the changes as diff which you can then save off somewhere.

Share:
29,268

Related videos on Youtube

Josh M.
Author by

Josh M.

Avid C#/.NET software engineer, database developer, UI/UX designer. Check out CodeGenerator - generate 90% of your code. Any language, any framework.

Updated on August 01, 2022

Comments

  • Josh M.
    Josh M. almost 2 years

    It seems SVN's "patch" functionality is not exactly what I want. What I really want is to create a diff of files between revisions. So, I'd choose rev1 and rev 2 and end up with a folder containing all files that were changed or added between those revisions.

    Can this be done with Tortoise SVN or plain-old svn?

    • Gab
      Gab almost 8 years
      what about files that were deleted between the two revisions?
  • Josh M.
    Josh M. almost 10 years
    I don't want a "patch" file, I wanted the raw files that changes between the revisions. The accepted answer solved my problem. Thanks.
  • Josh M.
    Josh M. almost 10 years
    I don't want a "patch" file, I wanted the raw files that changes between the revisions. The accepted answer solved my problem. Thanks.
  • Ben
    Ben almost 10 years
    Ah, so by "diff of files" you really meant "list of files that changed". Yes?
  • Josh M.
    Josh M. almost 10 years
    No, the actual files that changes. The accepted answer accomplishes this. Thanks!
  • Isa A
    Isa A over 8 years
    Or instead of Export Revision To, you can choose Show differences as unified diff to create a patch file.
  • eloone
    eloone almost 8 years
    To make a patch between current revision and an old revision 116615 you can do: svn diff -r 116615 {svn-branch-url} > file.diff