I'm trying to backup my shared bzr repository. I have looked at bzr export hotcopy.tgz but it seems only to take a snapshot of the latest revision.

Is there a command for doing backups, or do I have to

  1. full checkout into a tmp dir
  2. compress the tmp dir
  3. remove the tmp dir

Or is there a better way to backup a bzr repository?

share|improve this question
up vote 2 down vote accepted

You could try something like this:

mkdir /tmp/emptyrepos && bzr init /tmp/emptyrepos && bzr send -r 1..last:1 -o - /tmp/emptyrepos | gzip > mybackup.bzr.gz

That will create a bazaar native format merge-directive which you could apply to an empty repository to re-create all state.

Alternatively, it's likely safe to just tar up the current checkout. The on-disk format should be designed to safely deal with partial updates you may grab with tar.

share|improve this answer
    
When running this command, I'm experiencing this: ERROR: Not a branch: "/private/tmp/". I'm on Mac OS X. The I have tried inserting /private/tmp, but it gives same error. I'm new to bazaar so I don't quite understand the error message yet. – neoneye Dec 29 '09 at 21:28
    
The basic idea is to create an empty branch to diff against - you can make an empty directory somewhere and run bzr init within it; I just used something in /tmp/ because it's a good place to put temporary stuff. That said, are you sure you didn't mistype it? – Steven Schlansker Dec 29 '09 at 21:53
    
Here is the terminal output pastebin.im/1408 Thank you very much, but I think I go for the checkout temporary repository instead of using send, since it seems more simple. – neoneye Dec 29 '09 at 23:59
    
Just as a note, to restore a branch backed up in this way, you need to do "bzr init ." then "bzr pull <merge_directive_file_>". Merging into an empty branch is currently not supported (bug bugs.launchpad.net/bzr/+bug/82555) but pulling the merge directive will work. Just be sure to extract the merge directive from the .gz file, or else it will say it is not a branch. – mgrandi Nov 9 '12 at 1:33
    
'bzr send' is slow, not optimized for size, and not tuned to be used for entire repositories. Creating a temporary standalone branch without a tree (" bzr branch --no-tree") is the best way to create the data you need to back up. – jelmer Feb 7 '14 at 0:02

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.