SVN might be stable, it might be mature, it might be successful, and it might be the winning source control system of the moment. There’s always a big risk of resulting unpopular, when criticizing something that actually did find its way to success, but I have to say that SVN sounds terribly antique sometimes.
I have already given a brief introduction to the Darcs source control system, and I would like here to talk about a very strong point it’s got against SVN.
Just yesterday, at work, I needed to commit certain modification to SVN. As I examined the diff of my local copy with:
svn diff
I realized that one of the file also contained some other modifications that I didn’t want to commit. After using Darcs for several months, I was suddenly hit by the shocking truth: SVN doesn’t allow interactive and partial patches, which Darcs names hunks.
What do you do in that case? Provided that there are people who actually abuse the Save as... function of their editor by saving multiple copies of the same file according to the logical patch they contain (which I find absolutely horrible), the quickest way I could find was to:
- Making a diff:
svn diff > logical_patch_1.diff - Edit the diff manually, until I had two files, which represented the two logical diffs
- Revert the pristine:
svn -R revert . - Apply the first diff:
patch -p0 < logical_patch_1.diff - Commit:
svn commit - Apply the second diff:
patch -p0 < logical_patch_2.diff - Commit:
svn commit
With Darcs, all you have to do is issue the darcs record command (which records your changes):
- Record:
darcs record -m "First logical patch (fixes bug 1234)" - Answer “yes” to the first hunk, and “no” to the second.
- Record again:
darcs record -m "Second logical patch (fixes bug 5555)" - Answer “yes” to the only hunk
Can you see the difference? It’s not just about the number of operations needed, but the quality of them, and the fact that Darcs is perfectly oriented to this kind of flexibility. Please consider switching to Darcs for your projects and work, as it’s a mature and better system.
You have landed to my personal website, where I write about things that I find interesting. I am a software engineer, Open Source supporter and free thinker.
Perhaps you should adapt your workflow to fit better with the abilities of your SVN client? (Or modify the SVN client to support interactive commits.)
If you make separate logical changes to separate working copies, possibly even in different branches, then this is a non-issue. And it really isn’t that hard to manage.
The issue came out of the fact that I adapted my workflow to the use of an intelligent and interactive revision control system like Darcs. Getting to use SVN again showed to me this limit, which I believe is pretty serious.
Why should I modify the svn client if I can use darcs?
I’m pro-darcs as well, but partial patches is just a feature. It could be easily (at least i hope so) implemented in svn.
The difference is darcs is a distributed system. I can record patches locally even, when i’m not connected to a central repository.
#3 hit the nail on the head. There is a big difference between SVN and Darcs, and it’s not partial patches. It’s that Darcs is distributed, and SVN isn’t. There’s a world of difference between distributed systems like BitKeeper, Git, and Darcs, and centrally managed systems like CVS, SVN, VSS, etc.
Having said that, the features of each could be identical, but there are cultural issues that led both types of systems to support the features that they do today, based on how their typically used.
I’m not arguing that you’re wrong, of course. Only that you can’t tell the world to drop their existing system because of a single feature you happen to rant about. You either need to narrow the scope of your post, or take the time to write up a proper, full-length comparison and build up a strong, well supported case.
Well, you can implement this functionality yourself on top of Subversion client. Write a script that lets you make darcs-style interactive partial patches that are then automatically fed to svn commit. If it gets sufficiently popular, it might even be adopted by the mainline. They already ship with a plethora of various user-contributed scripts in the contrib directory.
Not to mention that even though I also like Darcs it does have great drawbacks, stuff that’s extremely impractical.
Example: Something/someone somehow borked a project I was working on (or part of it) between my last commit and {currenttime}. There has been a dozen commits or more but i need to track down which one broke what I was working on.
In SVN, it’s as simple as ‘svn up –rMYREVISION‘ and checking if the project is still broken, just perform a binary search to drill down to the culprit revision, when you’re done and have identified the source of the bug you can just ‘svn up‘ and voila, you’re done.
Darcs update? Nuh-uh, you’ll need a combination of ‘darcs get‘ to create branches of your current WD you can work on to track the culprit and ‘darcs obliterate –last=WHATEVER‘ to remove the last few patches and do the drilling down. Woohoo, way to go.
Yes I’ve also been annoyed by SVN’s inability to natively handle partial patches/changesets, but you can work your way around it (vimdiff is natively able to do that I think, for example). Darcs issues with going back in time to track the source-patch of a bug, on the other hand, is much more difficult to work around.
“Just use tests” you’re going to tell me? Yeah, I do, except that some things just ain’t testable. You just try to test the behavior of CSS stylesheets and get an alert when a rule’s side effect modifies another page you didn’t want to touch.
SVN sure ain’t perfect, but darcs ain’t either, they both have advantages and drawbacks over the other.
Why didn’t you just commit the two files? Unless you wanted to commit only sub-parts of the file? That wasn’t clear in your post?
Uhh, or you could just use svk, another Subversion client. It has interactive commits just like darcs does: see . (Not to mention that svk has similar distributed revision control system abilities to darcs/arch/Bazaar/Mercurial/etc.)
Making the jump from “Subversion doesn’t support interactive commits” to “Please drop SVN and use darcs instead” is pretty obnoxious: not supporting interactive commits isn’t exactly the end of the world. Are you going to start claiming that Bazaar-NG and Mercurial are inferior to darcs now too because that’s not their default mode of operation?
Seems that the link to svk got eaten in my last post. It’s http://bestpractical.typepad.com/worst_impractical/2007/01/svk_20_is_bette.html
straw man
That’s a nice feature but honestly, it doesn’t help my life enough to make me switch. I typically just write out the diff to a file and open it with (my already running) emacs, reverse direction and apply the hunks I don’t want anymore.
That probably sounds more complicated than it is. I live in emacs, anyhow.
Mike, that may not be *that* complicated, but it’s an hassle that darcs doesn’t give you. You must admit that you’re a bit of a particular user, to say the least
Partial patches? The way I operate is that I do a unit of work at a time. So either it all goes in with a checkin or none of it does. I do frequent checkins throughout the day, never lumping everything in at once.
Also by frequently checking in that avoids merge conflicts as everyone on the team is used to syncing up frequently. For that reason I’ll even check in code that partially fixes a problem (doesn’t introduce more) just so that others can see the latest stuff.
@ BlogReader // comment #15
You’re right, but just try darcs for 2 weeks. You can use it with snv at the same time, and then let me know
You might check out commit-patch: it automates the process you describe. It doesn’t support svn yet but it supports cvs, hg and darcs so svn support should be easy to add. .
Sorry, I borked the url up in my post: http://porkrind.org/commit-patch