Branches always freaked me out. From the day when I read the subversion manual I knew they are hard to deal with and the benifits are dubious.

If you ever had to deal with maintaining a fork, or a project that was forked – the technical challenges are exactly the same.

I imagine it’s reasonably easy to deal with if your commits to the version control system are atomic (e.g. one-liners to fix a bug). In that case you can just make a list of revisions with changes from one branch that you want in the other, and write a script to automate the merging for you. Do this for both branches and you’re fine. But life is not that simple.

There are two rules-of-thumb with version control that are relevant to this post:

  1. Only commit working code.
  2. One commit – one bugfix, or one feature.

The problem is these two are sometimes in conflict. For example: I change 5 files to add a feature and while doing that I run into a bug that’s in my way, I have to fix that bug or else my patch won’t do what it’s supposed to. So I end up with a patch that adds a feature and fixes a bug.

Yes, I could in theory somehow manage to not include the bugfix in my feature patch, but realistically that’s not doable most of the time – it’s just too much work.

Now I need to have a second branch for one of my projects, but I’m afraid to do it. I don’t have the time to go through svn logs, read all the patches, and merge the changes, sometimes manually. So the less profitable branch would end up out of date pretty soon. Which would be a shame, cause I’m rather fond of it.

Someone ought to extend subversion to be able to add flags to patches. So in my example above I could mark the bugfix lines as ‘BUGFIXP1’ and later tell subversion to give me all the patches marked so since some date in the past. Of course a change to a diff viewer would also be needed, so I can do the marking when I’m ready to commit.

I’ll put it on my list of interesting projects to work on but I don’t see the day when I’m going to have time to implement it. Oh well, maybe I’m just overly pessimistic about this.