Tips on working with subversion (SVN)

Make contributions

We welcome ideas and code contributions /fixes. you can make these in several ways:

  1. Diffs to the forum or developer email list
  2. committing code a subdirectory with your name in the contribs directory of the sources
  3. changing and committing the core software.

The idea is to start with 1. and progress towards 3. For 2. and 3. you'll need a SourceForge account for subversion and to be on the developer emails list.

For two and 3, you should also create documentation of your module/contribution, for example as an appendix to the Technical guide . For that you'll need a website account, and request "content editor" rights.

The rest of this document gives some example on working with subversion.

Checking out, committing changes

Checkout a working copy:
svn co https://opennac.svn.sourceforge.net/svnroot/opennac/trunk
svn co https://opennac.svn.sourceforge.net/svnroot/opennac/branches/3.0

Check for changes:
svn update contrib bin etc doc
svn help update

Make changes:
svn add <filename|directory>
svn delete <filename|directory>
svn copy <filename|directory>
svn move <filename|directory>
svn help [ add | delete | copy | move ]

Examine your changes:
svn status doc bin etc contrib
svn status <filename|directory>
svn diff
svn diff > <patchfile>
svn revert <filename>
svn help [ blame | status | diff | revert ]
svn [ blame | praise ]

Commit your changes:
svn commit --username YOUR_SF_USER –m "your message" contrib
svn commit --username YOUR_SF_USER –m "your message" doc
svn commit --username YOUR_SF_USER –m "your message" bin
svn commit --username YOUR_SF_USER –m "your message" etc
svn help commit

Subversion client settings

For servers behind a proxy, edit ~/.subversion/servers and set
the proxy values:
[groups]
group1 = *svn.sourceforge.net
[group1]
http-proxy-host = proxy1.MYDOMAIN.COM
http-proxy-port = 80

Limit what files are checking into SVN, edit ~/.subversion/config
[miscellany]
global-ignores = *.o *.lo *.la #*# .*.rej *.rej .*~ *~ .#* .DS_Store *,v RCS config.inc
Specifically, we don't want RCS files, or the productive config.inc
(with passwords) checked in

Merging a branch back to trunk

cd /trunk
svn update

Find the revision where the branch was created
svn log --verbose --stop-on-copy https://opennac.svn.sourceforge.net/svnroot/opennac/branches/2.2
For this example, branch 2.2 was created in revision 548

svn merge -r 548:HEAD https://opennac.svn.sourceforge.net/svnroot/opennac/branches/2.2

svn commit -m "Back to trunk"