The Linux distillery
Bringing the world of Linux to you, David cuts through the tech and shows you how it works and how to use it, in terms that apply to any distro. RSS
Technology news and Jobs arrow The Linux distillery arrow Compiling and contributing to the Linux/open source subversion
Compiling and contributing to the Linux/open source subversion E-mail
by David M Williams   
Monday, 03 December 2007
You can download the latest SVN client, which at the time of writing is v1.4.5, from Tigris.org. It is available in source code format, requiring compiling, or pre-compiled binaries for a variety of Linux distros as well as Microsoft Windows.

SVN is a command-line system (although GUI front-ends can be found) and has pretty much just one command, namely svn. The very first svn parameter you should master is checkout. This will download the entire source tree from the specified repository.
In the case of WordPress, their Subversion repository is hosted at svn.automattic.com/wordpress/trunk so the appropriate command is

svn checkout http://svn.automattic.com/wordpress/trunk

This invokes the svn command, instructing it to check out the whole repository at the URL given.
This only needs to be run once; once you have the repository the command to use hereon in is
svn update

This command is deceptively simple. It goes through your local copy of the repository as well as the master copy back on the server. It uploads any modifications you have made back to the server, and it downloads any modifications others have made to your copy. Where possible, if two or more people – including yourself – have modified the same file then changes will be merged so long as they don’t interfere with each other.

If you only want to build the latest version of an app, then these are the two commands you need; run svn update regularly and you’ll always be up-to-date.

If you’re contributing to a project, be sure to run svn update before you begin coding just to make sure your repository is current. This will help minimise any version conflicts which can occur if two people do edit the same section (and which require a bit of manual work to rectify.)

When you’ve finished working, don’t perform an update straight away; run svn status to confirm what you have actually done. This causes SVN to run through the project and advise you every file you have modified – and which it would upload if you updated – as well as any files that may be in a conflicting state.

You might find that you have inadvertently modified a file that you didn’t mean to, or no longer wish to. You may see that someone else has implemented a change you were working on and no longer need to.

The svn status command will show the names of files; to see more information – the actual lines of code themselves – run svn diff. This produces output showing how your files vary from the original versions you began with.

If you determine you wish to undo a change, you use the svn revert command followed by the name of file you want to send back to its original state – e.g. svn revert main.c.

Now you can update!

That’s the fundamentals of Subversion. If you’ve made it this far, you’re a Subversion champion. You have all the tools and commands and concepts under your belt to retrieve all the SVN repositories you crave.

There’s a lot more to version control however; there are many advanced things you can do like even branching one project into two different directions – and then bringing them back together again. As indicated earlier, you can review the version history for files. There’s a lot of power at your fingertips through the tiny three-letter svn command.

There’s a great book available online, for free, which goes through SVN in great detail and is well recommended.

Please enable JavaScript in your browser to post your comment!


Get stories like this delivered daily - FREE - subscribe now


 
< Next story in category   Previous story in the category >
iTWire user statistics Visitors last 30 days
Suscribers
904,266
13,751
#1 independent technology news advertise here
  •   *  
  • Search
  • AdvSeach
  • Login
  • Events
  • FreeStuff
Subscribe to our free e-newsletter