progging - To wander about and beg; to seek food or other supplies by low arts; to seek for advantage by mean shift or tricks.
progging - Programmer slang for writing computer code.

søndag 28. august 2011

Bazaar - Joining

One of the challenges when putting your project under version control is how to organize all the different projects/solutions/DLLs/what-have-your...Should everything be under one project in your VCS or should them be separate. It could be all independent programs that are released independently but still are part of the same 'package' and might even share some code.

When I first set up my projects I put them each under separate trees. I first learned this was a mistake when I wanted to move a file from one project to another. "Can't move files between different branches" - says Bazzar.

But luckily it is pretty easy to 'join' two branches into one!

My project was set up like this:


Because of a bug, the join command does not work if the main/root branch has no commits in it already. So if you don't have any files commited in the main directory yet, it's time to do so. First, the different project/branches was created like this:

Create common repository at main dir and make it a bazaar branch too
C:\MainDir>bzr init-repo .
C:\MainDir>bzr init .
Create a separate branch in each project directory
C:\MainDir\Dir1>bzr init .
...add and commit files in sub dir 1
C:\MainDir\Dir2>bzr init .
...add and commit files in sub dir 2
Then do a join and commit
C:\MainDir\bzr join Dir1
C:\MainDir\bzr commmit -m "joining Dir1"
The commands with output for joining two directories are shown here:

After the complete join the log history looks like this:

By default, only the main (important) revisions are shown.

Bazaar nicely handles revision history in different branches.
The solution was first found here: https://answers.launchpad.net/bzr/+question/71563

Ingen kommentarer:

Legg inn en kommentar