Developer Tips

From FreeSWITCH Wiki

Jump to: navigation, search

This page is a collection of tips for how to begin as a Developer working on FreeSWITCH. It is assumed that if you're viewing this page, you have your own SVN branch and are wondering what to do with it.


Initial Checkout

Assuming your branch is called 'mybranch' in the examples below. Change 'mybranch' to be your actual branch name.

$ cd /usr/local/src
$ svn co http://svn.freeswitch.org/svn/freeswitch/branches/mybranch freeswitch.mybranch
$ cd freeswitch.mybranch

$ svn merge http://svn.freeswitch.org/svn/freeswitch/branches/mybranch http://svn.freeswitch.org/svn/freeswitch/trunk

Determine what the trunk revision is that you just merged by typing "svn info" and looking at the Revision field. This is going to be critical information if you plan to keep your branch in sync with the main trunk as you develop it. For this example, we'll assume the trunk version is 4321.

$ svn commit -m "Initial commit of mybranch from trunk revision: 4321"

You now have a branch that contains a current copy of the trunk. You can now make changes locally to your branch to add new features, fix bugs, test patches, etc. Have fun!


Changing your branch

After you've made changes to the local copy of your branch, you can commit them to the SVN repository, so that other developers can test your changes, provide feedback, etc.

To commit your changes, the first thing you should do is clean up your local copy, by removing all compiled objects, output files, etc:

$ cd /usr/local/src/freeswitch.mybranch
$ make distclean

Now, review the changes that you are about to commit:

$ svn diff
[ ... Verbose output of modified files ... ]

Make sure that the output from the diff command is what you want to put into the SVN repository, that there are no stray files or such. Once you've verified this, go ahead and commit the changes. Include a brief message about what the changes are that you're comitting.

$ svn commit -m "Change to the foo.c file to fix bug in parsing the wibble input"
[ ... SVN Commit output ... ]

Make sure there are no errors or other complaints from the SVN server. You can now tell others to look at your branch to test your code changes.

Syncing with Trunk

As the main trunk is undergoing lots of changes, you may from to time want to pull changes from trunk into your branch. This can allow you to pull in bug fixes, feature enhancements, etc. This is important in making that any of your branch changes remain compatible with the main trunk. However, before syncing with the trunk it is recommended that you commit your local changes in a seperate commit -- this will ease the job of those who will eventually need to merge your branch into the trunk.

Remember that version that you logged in your initial commit message? This is where you need that version number. For this example, we're going to assume that this is the first time you are merging in trunk since you created your branch. Let's assume that the previous trunk version you merged is 4321.

$ cd /usr/local/src/freeswitch.mybranch
$ svn merge http://svn.freeswitch.org/svn/freeswitch/trunk -r 4321:HEAD
[ ... lots of merging ... ]

You've now pulled in changes from trunk into your branch, and retained your local changes. You have changes up through the most recent trunk revision ( as indicated by the HEAD in the merge command ). Note what this version number actually is. You will need it later, for future merges in from trunk. Let assume that the current trunk version is 5222.

$ svn commit -m "Merge of trunk revisions 4321 to 5222 into mybranch" 

To see the previous commit messages, you can use the svn log command. Note that this may be quite verbose.

NOTE: Always log the revisions you are merging in the commit message, if you don't it could be a real headache later on to figure out what is from where and when it got there.

Personal tools
Community