Please drop SVN

Feb 08 2007

SVN might be sta­ble, it might be mature, it might be suc­cess­ful, and it might be the win­ning source con­trol sys­tem of the moment. There’s always a big risk of result­ing unpop­u­lar, when crit­i­ciz­ing some­thing that actu­ally did find its way to suc­cess, but I have to say that SVN sounds ter­ri­bly antique sometimes.

I have already given a brief intro­duc­tion to the Darcs source con­trol sys­tem, and I would like here to talk about a very strong point it’s got against SVN.

Just yes­ter­day, at work, I needed to com­mit cer­tain mod­i­fi­ca­tion to SVN. As I exam­ined the diff of my local copy with:

svn diff

I real­ized that one of the file also con­tained some other mod­i­fi­ca­tions that I didn’t want to com­mit. After using Darcs for sev­eral months, I was sud­denly hit by the shock­ing truth: SVN doesn’t allow inter­ac­tive and par­tial patches, which Darcs names hunks.

What do you do in that case? Pro­vided that there are peo­ple who actu­ally abuse the Save as… func­tion of their edi­tor by sav­ing mul­ti­ple copies of the same file accord­ing to the log­i­cal patch they con­tain (which I find absolutely hor­ri­ble), the quick­est way I could find was to:

  1. Mak­ing a diff: svn diff > logical_patch_1.diff
  2. Edit the diff man­u­ally, until I had two files, which rep­re­sented the two log­i­cal diffs
  3. Revert the pris­tine: svn -R revert .
  4. Apply the first diff: patch -p0 < logical_patch_1.diff
  5. Com­mit: svn commit
  6. Apply the sec­ond diff: patch -p0 < logical_patch_2.diff
  7. Com­mit: svn commit

With Darcs, all you have to do is issue the darcs record com­mand (which records your changes):

  1. Record: darcs record -m "First logical patch (fixes bug 1234)"
  2. Answer “yes” to the first hunk, and “no” to the second.
  3. Record again: darcs record -m "Second logical patch (fixes bug 5555)"
  4. Answer “yes” to the only hunk

Can you see the dif­fer­ence? It’s not just about the num­ber of oper­a­tions needed, but the qual­ity of them, and the fact that Darcs is per­fectly ori­ented to this kind of flex­i­bil­ity. Please con­sider switch­ing to Darcs for your projects and work, as it’s a mature and bet­ter system.

19 responses so far

  1. Per­haps you should adapt your work­flow to fit bet­ter with the abil­i­ties of your SVN client? (Or mod­ify the SVN client to sup­port inter­ac­tive commits.)

    If you make sep­a­rate log­i­cal changes to sep­a­rate work­ing copies, pos­si­bly even in dif­fer­ent branches, then this is a non-issue. And it really isn’t that hard to manage.

  2. The issue came out of the fact that I adapted my work­flow to the use of an intel­li­gent and inter­ac­tive revi­sion con­trol sys­tem like Darcs. Get­ting to use SVN again showed to me this limit, which I believe is pretty seri­ous.
    Why should I mod­ify the svn client if I can use darcs?

  3. I’m pro-darcs as well, but par­tial patches is just a fea­ture. It could be eas­ily (at least i hope so) imple­mented in svn.

    The dif­fer­ence is darcs is a dis­trib­uted sys­tem. I can record patches locally even, when i’m not con­nected to a cen­tral repository.

  4. #3 hit the nail on the head. There is a big dif­fer­ence between SVN and Darcs, and it’s not par­tial patches. It’s that Darcs is dis­trib­uted, and SVN isn’t. There’s a world of dif­fer­ence between dis­trib­uted sys­tems like Bit­Keeper, Git, and Darcs, and cen­trally man­aged sys­tems like CVS, SVN, VSS, etc.

    Hav­ing said that, the fea­tures of each could be iden­ti­cal, but there are cul­tural issues that led both types of sys­tems to sup­port the fea­tures that they do today, based on how their typ­i­cally used.

    I’m not argu­ing that you’re wrong, of course. Only that you can’t tell the world to drop their exist­ing sys­tem because of a sin­gle fea­ture you hap­pen to rant about. You either need to nar­row the scope of your post, or take the time to write up a proper, full-length com­par­i­son and build up a strong, well sup­ported case.

  5. Mikhail Glushenkov

    Well, you can imple­ment this func­tion­al­ity your­self on top of Sub­ver­sion client. Write a script that lets you make darcs-style inter­ac­tive par­tial patches that are then auto­mat­i­cally fed to svn com­mit. If it gets suf­fi­ciently pop­u­lar, it might even be adopted by the main­line. They already ship with a plethora of var­i­ous user-contributed scripts in the con­trib directory.

  6. […] SVN ver­sus Darcs One valid argu­ment against SVN, a miss­ing fea­ture that I would find use­ful too. […]

  7. Not to men­tion that even though I also like Darcs it does have great draw­backs, stuff that’s extremely impractical.

    Exam­ple: Something/someone some­how borked a project I was work­ing on (or part of it) between my last com­mit and {cur­rent­time}. There has been a dozen com­mits or more but i need to track down which one broke what I was work­ing on.

    In SVN, it’s as sim­ple as ‘svn up –rMYRE­VI­SION‘ and check­ing if the project is still bro­ken, just per­form a binary search to drill down to the cul­prit revi­sion, when you’re done and have iden­ti­fied the source of the bug you can just ‘svn up‘ and voila, you’re done.

    Darcs update? Nuh-uh, you’ll need a com­bi­na­tion of ‘darcs get‘ to cre­ate branches of your cur­rent WD you can work on to track the cul­prit and ‘darcs oblit­er­ate –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 inabil­ity to natively han­dle par­tial patches/changesets, but you can work your way around it (vimd­iff is natively able to do that I think, for exam­ple). Darcs issues with going back in time to track the source-patch of a bug, on the other hand, is much more dif­fi­cult 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 behav­ior of CSS stylesheets and get an alert when a rule’s side effect mod­i­fies another page you didn’t want to touch.

    SVN sure ain’t per­fect, but darcs ain’t either, they both have advan­tages and draw­backs over the other.

  8. Why didn’t you just com­mit the two files? Unless you wanted to com­mit only sub-parts of the file? That wasn’t clear in your post?

  9. Uhh, or you could just use svk, another Sub­ver­sion client. It has inter­ac­tive com­mits just like darcs does: see . (Not to men­tion that svk has sim­i­lar dis­trib­uted revi­sion con­trol sys­tem abil­i­ties to darcs/arch/Bazaar/Mercurial/etc.)

    Mak­ing the jump from “Sub­ver­sion doesn’t sup­port inter­ac­tive com­mits” to “Please drop SVN and use darcs instead” is pretty obnox­ious: not sup­port­ing inter­ac­tive com­mits isn’t exactly the end of the world. Are you going to start claim­ing that Bazaar-NG and Mer­cu­r­ial are infe­rior to darcs now too because that’s not their default mode of operation?

  10. 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

  11. straw man

  12. That’s a nice fea­ture but hon­estly, it doesn’t help my life enough to make me switch. I typ­i­cally just write out the diff to a file and open it with (my already run­ning) emacs, reverse direc­tion and apply the hunks I don’t want anymore.

    That prob­a­bly sounds more com­pli­cated than it is. I live in emacs, any­how. :-)

  13. Mike, that may not be *that* com­pli­cated, but it’s an has­sle that darcs doesn’t give you. You must admit that you’re a bit of a par­tic­u­lar user, to say the least :)

  14. […] Ver­sion­ing sys­tems like CVS, SVN or Darcs are very impor­tant tools, that no seri­ous pro­gram­mers can omit to use. If you started a project with­out using any ver­sion­ing tools, I really rec­om­mend that you start using one imme­di­ately; but I’m not dis­cussing this right now. I would like to point your atten­tion to some best prac­tices that I rec­om­mend when work­ing in a team. […]

  15. Par­tial patches? The way I oper­ate 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 fre­quent check­ins through­out the day, never lump­ing every­thing in at once.

    Also by fre­quently check­ing in that avoids merge con­flicts as every­one on the team is used to sync­ing up fre­quently. For that rea­son I’ll even check in code that par­tially fixes a prob­lem (doesn’t intro­duce more) just so that oth­ers can see the lat­est stuff.

  16. @ Blo­gReader // com­ment #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 :)

  17. Sub­ver­sion Oblit­er­ate, the for­got­ten feature…

    Sub­ver­sion Oblit­er­ate has been a much wanted fea­ture for many years now, yet it is not even planned or men­tioned on the Sub­ver­sion roadmap. Dis­cus­sions have been going on and money has been wav­ing, yet still no move­ment towards a con­crete implementatio…

  18. You might check out commit-patch: it auto­mates the process you describe. It doesn’t sup­port svn yet but it sup­ports cvs, hg and darcs so svn sup­port should be easy to add. .

  19. Sorry, I borked the url up in my post: http://porkrind.org/commit-patch

Leave a Reply