Use bazaar and subversion together

Subversion is great and I have been using it for years. But I keep running into the same two problems over and over:

  • I did a bunch of work and I want to commit it, but I don’t have network access.
  • I spent a day playing around with a crazy idea, and I want to store my half-finished and buggy work. I don’t want to put it into the trunk because it will break a bunch of other people’s work. I don’t want to make a branch because I find branching and merging again to be tedious.

Both problems could be solved if I could make commits that were local to my hard drive and visible to me only.

Today I spent a few hours on IRC and I found out that bazaar plays really nicely with subversion, and now I have a solution.

  1. First, I loaded my subversion repository into bazaar. Here’s the command I ran:

    bzr branch svn+http://my-svn-repository.example.com/myproj

    My subversion repository has 990 revisions. This command took about 3 minutes to finish.

  2. Then I went into the local myproj directory and edited some code. I used bzr status and bzr diff to see what I changed while I worked. They operate nearly identically to their svn counterparts, but bzr diff has no --summarize option.
  3. Committing locally is really simple:

    bzr commit -m "This is a local commit and svn won't see it!"

  4. Then I did some more edits and committed those:

    bzr commit -m "OK, now maybe I have something that I want to put into subversion."

  5. Before committing to the subversion repository, I pulled down other people’s updates to the subversion repository like this:

    bzr pull svn+http://my-svn-repository.example.com/myproj

    This is a lot like running svn update.

  6. After making sure my stuff plays nice with other people’s updates, I pushed my stuff into subversion:

    bzr push svn+http://my-svn-repository.example.com/myproj

  7. Now when anyone runs svn update in their subversion working copy, they will get my work along with my commit comment.

So far, I’m really happy with this set up. The Bazaar-Subversion FAQ had a lot of really useful tips. Finally, there’s still a lot of stuff I haven’t tried yet, like renaming or copying files with svn.

  • http://technomancer.me.uk Charles

    I could go all blackadder on how cunning that it but I’ll just say that the above trick is really useful, and may be a stick to beat the ‘version control is pointless’ muppets with.

  • http://tplus1.com matt

    Charles, thanks for the comment! Those muppets deserve to be beaten senseless.

  • dfkg

    Thank you very much for this little tutorial.

    Very useful !

  • http://tplus1.com matt

    dfkg: I’m glad you liked it!

  • http://dev.spartancoder.com Andrei

    Nice! I will try this as soon as possible. Is it possible to use bazaar and cvs in the same way?

  • http://boksiora.googlepages.com/home2 web design

    It’s really nice that the svn integration is seamless – git-svn requires the user to learn a completely separate set of commands for interacting with svn. Having backends for all the popular revision control systems would be a killer feature.

  • http://www.valwriting.com Essay Help

    Hi, Thanks for this wonderful post I just want to asking few things can any one help reply me back:)

    Thanks

  • Johjoik

    Woo this is a nice blog, i would love to read more.

    regards
    harsel gibs
    ______________________________________________
    watch scrubs | watch west wing online | watch lost

  • AriasTaylor

    You got a nice blog up there.

    regards
    james kails
    ______________________________________________
    seattle house cleaning | internet marketing course | watch smallville Online

  • ScherrerStiles2222

    Hello Guyz I added this post to my article site. You can view this here.

    regards
    james kails
    ______________________________________________
    cataract eye drops for dogs | Nintendo Ds cases | watch gossip girl online

  • http://www.wholesaleinc.net/ wholesale Electronics

    Another comment by another ordinary person

  • http://gaganrana.wetpaint.com/ Gagan Rana

    I loved the way you exlained things. Much better many here

  • http://caoch.net/ coach outlet

    thank you for your post,nice,i am appriciate what you said!