7

I have been using Bzr for version control of my project over the last few months. I am the sole developer, and currently I just have everything in a single local project directory, to which I commit and which I sync to DriveHQ.

I now have some large-scale experiments in mind which would likely break this main line, so I've been looking into the concepts of branches and shared repositories. So my question is, basically: how should I go about creating a new, shared repository from this already-version-controlled base?

I am familiar with the SVN project structure of trunk, branches and tags, and I'm going to adopt this structure. My plan is to just go ahead and do a fresh init-repo, and copy all my code (plus .bzr) over into the trunk folder. So is this OK? Or is there some way to convert what I have already into a shared repository?

Many thanks in advance for any help.

Christopher

ChrisM
  • 2,128
  • 1
  • 23
  • 41

2 Answers2

10

OK, so you have some work directory where your standalone branch is. You want to create trunk and feature branches in new shared repo.

At first you need to create a shared repository itself:

bzr init-repo /path/to/repo

Now you can put your code to repo/trunk. You can use push, branch or you can copy work and use reconfigure.

  1. cd work; bzr push /path/to/repo/trunk
  2. cd path/to/repo; bzr branch /path/to/work trunk
  3. or copy/move work to /path/to/repo/trunk then cd /path/to/repo/trunk; bzr reconfigure --use-shared

In all cases you'll have branch trunk as a copy of your old work, and this trunk will use shared repository to save the revisions.

You can also look at bzr-colo plugin.

bialix
  • 20,053
  • 8
  • 46
  • 63
  • For me, I used #1 and it also worked perfectly (I think). I had same situation and used #1. To confirm, I `cd /path/to/repo`, where I type `bzr info` and get `Shared repository with trees (format: 2a)` (newline) `Location:` (newline) `shared repository: . ` . And then I type `bzr info trunk` which gives `Repository tree (format: 2a)` (newline) `Location:` (newline) `shared repository: . ` (newline) `repository branch: trunk ` . Thanks @bialix! – Kalin Apr 18 '14 at 04:16
4
  1. Create a folder outside your current repository.
  2. Call bzr init-repo to create a shared repository
  3. From your working tree push to the newly created shared repo.

You can now work directly on the shared repo

TridenT
  • 4,879
  • 1
  • 32
  • 56
  • 1
    I wanted to suggest tha same but instead of push , do branch from the old rep to the new one. is there a difference? – Gil.I Dec 11 '11 at 07:39
  • 1
    @Gil: you can branch in the new shared repo from the old working copy, it works also. – TridenT Dec 11 '11 at 09:25
  • 1
    @TridenT: Many thanks, very helpful. Just to clarify, can I then safely delete the old repository? And should I do that from Bzr, or can I just drag it to the trash? – ChrisM Dec 11 '11 at 19:56
  • 1
    @ChrisM Yes, once it is pushed, you can delete the old one. – TridenT Dec 12 '11 at 17:48