Tag Archive for 'patch'

Subversion Tip of the Week

Apache Subversion supports the creation and use of ‘patches’ – text files containing the differences between two files. Patches specify which lines have been removed, added and changed, and are particularly useful when you don’t have write access to a repository. In these instances, you can create a patch file showing the changes between a file as it exists in the repository, and the version in your working copy. Then, you can create a ticket and attach your patch file for someone with repository write access to review and commit the accepted changes to the repository.

To create a patch file, you first need to review the differences between the specific files/revisions you are targeting using the ‘svn diff’ command. In this example, we are examining the differences between the version of the project in our working copy and the central repository.

tip of the week

If you’re satisfied with the differences ‘svn diff’ has identified, run the following command to create a patch:

svn diff > patch_name.diff

tip of the week 2

All the changes will now be written to a patch on your local machine.

tip of the week 3

You can now send this patch to a user who does have write access to the repository.

Creating a Patch Between Revisions

Alternatively, if you want to create a patch containing the differences between two revisions, run the following command:

svn diff r:(revision)(revision) (working-copy-location)

Followed by:

svn diff > patch_name.diff

Again, this patch file can now be submitted to someone with write access.

Want more advice on your Apache Subversion installation? We have a full series of SVN refcards for free download, covering hot topics such as branching and merging, and best practices. You can find out more at www.wandisco.com/svnref

Working with Patches in SmartSVN

SmartSVN supports the creation and usage of ‘patches’ – text files containing the differences between two files. Patches specify which lines have been removed, added and changed, and are particularly useful when you don’t have write access to a repository. In these instances, you can create a patch file showing the changes between a file as it exists in the repository, and the version in your working copy. Then, you can create a ticket and attach your patch file, for someone with repository write access to review and commit the accepted changes to the repository.

Patches are created by comparing two revisions of your project (or by comparing your local changes to the version in the repository) and generating a local patch file.

Create a Patch in SmartSVN

To create a patch file in SmartSVN:

1) Open the ‘Query’ menu and select ‘Create Patch…’

2) In the subsequent dialog, select the ‘Choose’ button.

3) In the ‘Save File’ dialog, choose the file path where your patch will be stored, and enter a name for your path.

4) Select ‘OK’ to return to the ‘Create Patch’ dialog. Select ‘Create Patch.’

5) SmartSVN will confirm the creation of your patch, and remind you where this patch has been stored.

You have now successfully created your first patch in SmartSVN!

Create a Patch Between URLs

1) Open the ‘Query’ menu and select ‘Create Patch Between URLs…’

2) In the ‘Create a Patch between URLs’ dialog, specify the ‘from’ path and the ‘to’ path, and select the revisions you wish to compare and create a patch for. Alternatively, you can opt to compare the HEAD revisions of two paths.

3) Finally, enter the location where the patch should be saved. Once you are happy with the information you have entered, click ‘OK’ to go ahead and create the patch.

Need more help with your SmartSVN installation? SmartSVN Professional includes one year of email support. Find out more at http://www.smartsvn.com/buy