Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

At our company we are using SVN repository. I'm doing programming from both work (main place) and home (mostly experiments and refactoring). Those are two different machines, in different networks and almost never turned on at the same time (after all I'm either at work or at home...)

I wanted to give a chance to some distributed version control system and solve some of the issues associated with SVN based process and having two machines. From git, Mercurial and Bazaar I chose to start with Bazaar since it claims that it is designed do be used by human beings. Its my first time with distributed system and having nice and easy user interface was important for me.


Features I wanted to achieve were:

  1. Being able to update from SVN repository and commit to it.
  2. Being able to commit locally steps of my work on a task.
  3. Being able to have few separate tasks at the same time in their own local branches.
  4. Being able to share those branches between my work and home computer.

As a means of transport between work and home computer I wanted to use a pen-drive. Company server will not work since I may not instal there anything. Neither will work a web service repository as I may not upload source code to web (especially if it would be public which seems to be a common case in free web services).

This transport should be Bazaar-based (or what ever else I will end with) so it can be done more or less automatically but manual copying and pasting some folders or generating patch files (providing they would work - I have bad experience with patch files in SVN) would work as well if there is no better solution.

Yet the pen-drive should only be used for transportation. I do not want to edit or build there.


I tried following Bazaar guidelines for integration with SVN. But I failed. I tried both

bzr svn-import

and

bzr checkout

providing URL from my repository as both https://... and svn+https://.... In some cases it had some issues with certificates but the output specified argument to ignore them so I did that. Sometimes it asked me to log in (in other cases maybe it remembered... I don't know) which I did.

All were running very slow (this could be our server issue) and at some point were interrupted due to connection interruption (this almost for sure is our server issue: it truncates the connection after some time). But since (as opposed to SVN) restarting starts anew rather than from point where it was interrupted I was unable to reach all the ~19000 revisions (ending usually somewhere around 150).


What and how should I do with Bazaar? Is is possible to somehow import SVN repository from the local checkout (so that I do not suffer the connection truncation)? I was told that a colleague that used to work with us has done something similar (importing SVN repository with full history) with Mercurial like in no time. So I'm seriously considering now trying Mercurial even if only to see if that will work.

But also what are your general guidelines to achieve the listed features?

share|improve this question
    
I already tried (just now) Mercurial yet it seems there is not direct support for SVN and their Wiki warns that the existing support through plug-ins is not production ready. Still I decided to give it a try but I failed at installing the plug-in. I'm "Windows-kind-of-guy". I like to have an exe/msi file to double click and have everything done. While hgsubversion (this one I tried) in installing instructions started with downloading and building sources. I downloaded what seemed like "binary" yet I failed in finding where to put it and enable the extension. I gave up (for now). –  Adam Badura Mar 26 '12 at 18:16
    
Then I moved to Git just to be reminded that it required Cygwin or msysGit. But still I will try it now. (Not to mention that download page code.google.com/p/msysgit/downloads/list isn't clear on what to download if I want the latest stable version since few last versions are all tagged as Beta...) –  Adam Badura Mar 26 '12 at 18:18
    
I use hg+hgubversion without big headache. –  Lazy Badger Mar 26 '12 at 18:33
    
Just some URLs for reading (non-English omitted) Why Not Bazaar Not a holy war - just some salient facts –  Lazy Badger Mar 26 '12 at 18:35

2 Answers 2

I believe that Bazaar is the most sensible DVCS out there, and is especially good for users familiar with Subversion. It can be used very effectively with a Subversion system.

It looks like bzr svn-import command imports all branches from Subversion, which is probably not what you want. It's not possible to import from a Subversion checkout because Subversion doesn't keep the entire history locally.

Since you want to use multiple branches you should first create a shared repository to save on disk space and time when branching.

bzr init-repo ~/project

Then use the bzr checkout command to create a checkout from your Subversion trunk. Specify the Subversion URL to the project trunk.

cd ~/project
bzr checkout https://svn.example.com/project/trunk trunk

You will then have a Bazaar tree in ~/project/trunk which is bound to the Subversion trunk. A bound branch means that commits are automatically pushed to the remote branch, i.e. anything you commit here will be committed to the Subversion trunk.

When you want to make some changes, create a new branch from your local trunk.

cd ~/project
bzr branch trunk fix-some-bugs

Work in ~/project/fix-some-bugs and commit as you go along. All of this will happen locally and won't affect the Subversion trunk. You can create as many branches as you want.

When you want to commit these changes to the Subversion trunk, merge the branch into your local trunk. First make sure that your local trunk is up to date by using bzr pull.

cd ~/project/trunk
bzr pull
bzr merge ../fix-some-bugs
bzr commit

This will commit all the changes you made in the branch as a single revision in Subversion (even if you made multiple commits in the branch).

share|improve this answer

There is a way to continue interrupted checkouts. If you create a shared repository, and then start the checkout inside of that, then if the checkout is interrupted, you can delete the directory with incomplete data and repeat the checkout command. Like this:

bzr init-repo ~/project
cd ~/project
bzr checkout https://svn.example.com/project/trunk
# ... gets interrupted ...
rm -fr trunk
bzr checkout https://svn.example.com/project/trunk

Repeat the checkout as long as it takes.

Btw, the checkout is extremely slow at first, because it downloads the full history. This is also the reason why you cannot just import a local subversion checkout, because subversion only downloads a single revision, doesn't have the full history.

After checkout is complete, you can use the branch exactly the same way as you use subversion. Before you start working on new code, you do bzr update to get the latest and greatest from your company's project, when you want to commit you commit as usual, and it will be committed to Subversion just fine.

You can use the distributed capabilities of Bazaar to the full. Everything you describe in your question is possible with Bazaar, but doing them requires a good understanding of distributed version control. The fact that the backend repository server is Subversion, makes little to no difference in practice, the bzr-svn plugin makes it all transparent.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.