wiki:SvnRules
Last modified 8 months ago Last modified on 03/30/2017 01:03:56 PM

Checking out

To check out the software of FACT (or just a part of it) you need to know the URL for the

user@host:~$ svn checkout <URL> 

call. In order to find out this URL, just click on the "Browse Source" button on the upper right side of this page. Browse to the partent folder you want to checkout and copy the URL from your browsers address field to your command line, the URL you copy might look like this:

https://trac.fact-project.org/browser/trunk/Mars

Note: Before you hit <Enter> replace '/browser/' with '/svn/'. So for the example the call might look like this:

user@host:~$ svn co https://trac.fact-project.org/svn/trunk/Mars mars

This call will checkout the current version of Mars form our SVN repository and dump it into a new folder called mars/ in your home folder.

Start working -- Create A Branch

If you have an idea and want to try it, we invite you to profit from FACTs code versionion system right from the start. Who knows, maybe your idea will one day be a vital part of the std-analysis.

However it's reasonable not to mess with other peoples work, so you might just create a Branch(http://svnbook.red-bean.com/en/1.7/svn.branchmerge.using.html) for your private work. If later you want to share your work with others, or have it revised, just tell them about your branch.

Creating a Branch

Let's look at branching using the Example of Mars. Suppose you want to develop something in Mars, you may create your private branch of Mars. Branches are cheap in the sense, that on the svn server, there is not actually made a copy. It merely notes from which part of the trunk your branch springs off. Is suppose you are creating a branch of the most recetn version of the trunk (of course it is also possible to create branches of historic versions, we'll come to that later)

(Inspired by http://guides.beanstalkapp.com/version-control/svn-branching.html)

Let's say you want to add some new feature to a FACT++ program. I assume you have the trunk checked out on you laptop somewhere (say ~/fact/FACT++). You might want to make sure, you really branch off the most recent version:

~/fact/FACT++:$ svn update
Updating '.':

At revision 18794.

Create a remote branch (without checking it out -> very fast)

~/fact/FACT++:$ svn copy ^/trunk/FACT++ ^/branches/FACT++_ticket-15 -m "Branch for ticket-15"
Committing transaction...
Committed revision 18795.

Copy you working dir locally into a new branch (also fast -> no network load):

~/fact/FACT++:$ cp -r . ../FACT++_ticket-15

Now comes the trick:

~/fact/FACT++:$ svn switch ^/branches/FACT++_ticket-15 ../FACT++_ticket-15 --ignore-externals
At revision 18795.

Feel free to work in your branch the way you like best, but if you later want to merge your branch back into the trunk, it might be useful to rather do many smaller commits than one big commit.

Comitting

Before you commit anything, check which files would be committed:

svn diff | grep Index

Now you have a list of files... choose the ones you want to submit and check the diff

svn diff filename

You might find surprises sometimes. A change you forgot or a change which was only for debugging. Clean your change. Now you are ready to commit the file

svn ci filename -m "Comment"

Write a comment which tells the type of change, the reason of change and maybe some details. Write comments for every change you made, try to be as detailed as possible. Hint: If you write a comment which needs the name of a file or class, most probably it is the wrong comment because it applies to another file.

Do that for each file independently, file by file. It is very rare that the same comment applies to several files. If this is the case, make sure that you checked all their diffs and then commit all of them together.

Revert

Sometimes it might happen that you committed something by mistake. For example, you thought to do svn ci filename but in fact did svn ci and committed file which were not intended to be committed. Don't forget to keep the list of files which need to be reverted as soon as possible before it is off your console history!

I have created a short script (I called it *revert.sh*) which allows to revert the last change (unfortunately only file-by-file, but this makes sense to ensure you know what you do).

svn merge -r COMMITTED:PREV $1
svn ci $1 -m "Reverting to last revision."
svn merge -r COMMITTED:PREV $1