Subversion Update Tips
Subversion has been an excellent tool for version control, but certainly with its own frustrations.
One of these has been knowing where you are (or, rather, your working copy is) in relation to what is what's on the server's repository.
Version 1.5, approximately, introduced a few changes which make this much simpler. At least with v1.6 you can do this, assuming you are in a subdirectory under one in svn control:
$ <strong>svn ls ^/tags</strong>
1.5/
[...]
3.0/
3.0.1/
3.0.2/
3.0.3/
$
Huzzah! Subversion replaces the caret with "the root URL of the repository for this checkout" -- I sure wish I had known this a lot earlier. Now I can see what other tagged versions are available.
Some of you may have guessed my working copy was of Wordpress. Here's how we can see exactly what's going on in a particular tagged version, without actually checking it out:
$ <strong>svn ls ^/tags/3.0.3/wp-includes/ -v</strong>
16803 westi Dec 08 10:50 ./
13211 nacin Feb 18 2010 Text/
8149 westi 10928 Jun 20 2008 atomlib.php
15148 nacin 11549 Jun 05 2010 author-template.php
12525 ryan 9624 Dec 23 2009 bookmark-template.php
[...]
Ah, you say, but I have the tagged version I want... I just want to
know what will happen if I type svn update
...? Well try this:
$ <strong>svn diff -r HEAD</strong>
That will show you the differences between your current working copy and the latest edition (head) of the currently checked out version... which is the differences that will be applied if you did an update.
OK, now I'm ready to switch my version... this used to be a bit of a pain, having to copy the URL... but now we can just do:
$ <strong>svn sw ^/tags/3/0.3</strong>
<em>or maybe</em>
$ <strong>svn sw ^/trunk</strong>