Jumping ship! From Subversion To Mercurial

I've been a big fan of Subversion since 2005, but since lately I've been having a bit of distributed source-control envy. Many people seem to be switching to Git and Mercurial, and frankly I've felt a bit left behind.

For some smaller stuff I've been starting to use Mercurial a bit more, and I've been pretty easily convinced since then. If you have some random code lying around, and need to make some changes you might need to revert? Just enter "hg init ." and now it's a repository. hg add, hg commit and it's committed as a first repository.

So I've bit the bullet and now also converted SabreDAV to Mercurial, which was a very easy process using Google's manual (which by the way could apply for non-google repo's too). The biggest change from here on is to remember to type hg instead of svn.

Joel Spolsky actually recently wrote a nice tutorial for hg, pretty easy to get through; especially if you already understand version control.

Subversion 1.5 for debian Etch

The Subversion team released version 1.5 recently, with some really tight features such as changelist and merge tracking.

In our shop we standardized on Debian, and it's very likely going to take till 5.0 (lenny) until we get access. Normally I would just do a compile from source, but since this will have to be done on multiple servers, I decided to backport subversion from Lenny to create a nice little .deb package.

Here are my steps, (tested on just my machine, so please try at your own risk).

  1. We'll start off by creating a directory for this process.
    1. mkdir subversion
  2. Next, download the source packages from the debian packages site.. They're on the right.
  3. Now, unzip them.
    1. gunzip subversion_1.5.0dfsg1-4.diff.gz
    2. tar xfvz subversion_1.5.0dfsg1.orig.tar.gz
  4. The first file was patch with debian specific changes, we'll need to apply this patch to the source tree.
    1. patch -p0 < subversion_1.5.0dfsg1-4.diff
  5. Enter the source directory
    1. cd subversion-1.5.0dfsg1/
  6. We'll need to change some file permissions to make this work.
    1. chmod 755 debian/rules
  7. Now we switch to the root user, because we need to install some dependencies.
    1. # Assuming you're root
    2. apt-get build-dep subversion
    3. apt-get install python-all-dev libneon26-dev quilt libsasl2-dev fakeroot debhelper
  8. Switch back from root to your normal user.
  9. I've had some issues making creating the java hooks. To get around this, we'll need to disable them. Do this by opening the 'debian/rules' file and change the line that says 'ENABLE_JAVAHL' to no. For me this was on line 21.
    1. ENABLE_JAVAHL := no
  10. Now we can get started building the package.
    1. dpkg-buildpackage -rfakeroot -uc -b -d

  11. Compiling!
  12. If everything went well, you should have ended up with about 10 .deb packages in the directory right above the source directory. You can simply install all of them with:
    1. dpkg -i *.deb

Keeping your home directory in subversion

When your working and developing on many boxes, either physical computers or SSH-ing into remote servers it can be quite cumbersome to manage all your settings..

So just recently I started using subversion for managing my home directory.. it works great! I can just update, and commit to the central server and I just keep an "svn update" in my .bash_profile. Always in sync!

And.. you get the added benefit of decentralized backups (since its checked out on multiple boxes) and you can revert to a previous version in case you screw up.

Among other things, the repository now contains:

  • .bash_profile
  • .bash_rc
  • All my VIM settings and plugins
  • My SSH settings
  • a public_html folder
  • A dev folder with svn:externals to my most worked-on projects
  • My .netrc
  • A (password protected) sym-link from the dev/ to the public_html/ folder
  • Random shit

So yea, I just wanted to share this thought for people who might be dealing with the same issues.

Grepping in your subversion working copies

Grepping is in a lot of cases a pain when your dealing with subversion directories..

I'm sure this doesn't cover all possible greps, but this at least works for the simple ones..

  1. #!/bin/sh
  2. grep $* | grep -v ".svn"

Call this script for example "svngrep", give it executable permissions (chmod +x svngrep) and place it in a directory thats in your PATH variable (/bin).

Now, use svngrep as you would normally use grep..

Update: The anonymous posters script is way better (the first comment)

Building Subversion from source on debian

The official debian packages for Subversion are kind of old; the latest version is 1.1. There is a more recent package available in the 'unstable' package source, but I'd rather just stay with the stable packages, because switching to unstable requires me to update a few hundred packes; and I'd just rather not..

To install on debian, perform the following steps:

  1. Download the subversion packages from the subversion site.
  2. Run (as root):
    1. apt-get build-dep subversion libsvn0 libapache2-svn
    This will install all the libraries you need to build subversion (among a few other packages to make a debian package out of it).
  3. Next, unpack the subversion files with:
    1. tar xfvz subversion-???
  4. Next cd into the directory where the files were unpacked
  5. Run the regular:
    1. ./configure
    2. make
    3. make install
  6. You are done!
 1

About

My name is Evert, and I've been writing semi-regularly on this blog since 2006.

I'm currently available for contract work.

more info.

Subscribe

Dropbox

Dropbox is a simple cross-platform online backup and sync application. The first 2GB of space is free, and both you and me get an extra 250MB extra space if you sign up through this link.