views:

128

answers:

4

What is the easiest way to submit a working patch or bugfix to an Open Source project using SVN?

Ideally, I would like to submit a revision or patch so they can easily apply it in their repository directly if they approve it.

I'm using TortoiseSVN if it matters.

+2  A: 

Unsually, the SVN access is available for the developers only, simply to prevent the accidents made by the people who may not know the code or even want to demolish the repository. The patches can be sent via bugtrackers - you make a check-out, then modify your working copy. Because you cannot send your changes back with SVN, you create a diff file (patch) and publish it on project discussion board or bugtracker, depending on the issue it solves. If the users and the developers liked it, they would integrate it with the official repository. With a diff file, it is quite easy.

Note that sometimes it is possible to get your own branch of the project. For example, the open-source game OpenTTD offers git repositories for people who would like to maintain their own patches or new features. Other projects may use Launchpad.

Zyx
+1  A: 

You will want to make sure you have the latest updates of the source code, and to make sure that any changes you have made still correctly merge into the code. After that you will want to make an diff on the original source code and the new source you have written (svn diff).

You take this diff, and send it to the appropriate location, for example an mailing list, a bug tracker of some sort, or to the original author if the project is run by a single person.

X-Istence
+5  A: 

right click->tortoise svn->create patch

This will save the changes in your working copy in a patch file. When doing so, you get to see the full list of the changes you have :)

Ps. notice how with ->apply patch, anyone can easily apply the saved patch to a local version.

eglasius
+3  A: 

This is what you should do:

  1. Make sure the bug is not already fixed (on trunk or a branch). Often bugs that are present in a release are already fixed in the development code.
  2. Get a working copy of the code
  3. Fix the bug in your working copy, compile and test it
  4. When fixing the bug, use the same coding style (e.g., tabs/spaces, indentation, variable naming, ...) as the existing code
  5. Since you're using TortoiseSVN: right-click on your working copy, TSVN submenu->Create Patch. Save the patchfile somewhere.
  6. zip the patchfile (most email apps mess with whitespaces in attached text files, and the patch file should not be messed with at all - zipping it prevents that)
  7. Send the patchfile to the projects mailing list (or the project developer), describing the bug you fixed, how the bug can be reproduced (or how you detected it) and maybe how you fixed it
  8. Check the mailing list for questions the developers might have about your patch
Stefan
Thanks Stefan for your input. Love your work on TortoiseSVN!
Simucal