← Back to team overview

bzr-doc team mailing list archive

Re: the branching thing


On Tue, Dec 1, 2009 at 3:53 PM, Sebastian Spiess <sebastian.spiess@xxxxxxxxx
> wrote:

> Hi Bzr-doc List,
> I've used bazaar now for a while - I'm not a programmer so my usage is
> mostly keeping track of some batch files and /etc/* and I'm not familiar
> with a typical code colaboration work flow.
> By now I've read quite a few pages in
> http://doc.bazaar-vcs.org/bzr.dev/en/user-guide but I could not figure
> out how I get started with having branches etc.
> My current challenge is that I've got a .htaccess file, sort of my
> trunk.
> Now I want to branch the htaccess file for multiple domains with small
> variations.
> If I have a change which will affect all branches I do the modification
> in trunk and pull in the branches. Thats what I think I need to do - but
> how exactly.
> I would love to see an example work flow for various bzr commands. Pull
> and commit are probably covered in the help already.
> I hope this is what belongs into this list :-)
> Cheers Sebastian
> _______________________________________________
> Mailing list: https://launchpad.net/~bzr-doc
> Post to     : bzr-doc@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~bzr-doc
> More help   : https://help.launchpad.net/ListHelp
I'm sure that if this isn't the right list, someone will kindly point you in
the right direction. In the mean time I'll see if I can help a little.

>From what I understand you have an .htaccess file that you need modified
slightly for several hosts (or virtual hosts etc). So lets start with your
basic (trunk). From what you said, you already use bzr for it, but in case
someone else needs this info I'm going to assume you know next to nothing
about bzr and it's commands.

First, you would create your .htaccess base file. The trunk so to speak.
Then you would add that to a bzr branch. Here's how it would go.

$ mkdir ./work
$ cd ./work
$ vim .htaccess
<hack hack hack>
$bzr init
$bzr add
$bzr commit -m"Initial commit"

This would add your .htaccess to a bzr branch. Next you want to change this
base file to be specific for host X. So you create a new branch.

$ cd ../
$ bzr branch ./work ./Xspecific
$cd ./Xspecific

This would put you in the branch you just created called Xspecific. Then you
can make your specific changes to Xspecific. And then commit. You could
repeat this with branches named Y, Z, etc. Then lets say you need to make a
change that will affect all of them.

$ cd ../work
$ vim ./.htaccess
$ bzr commit -m"made small change that affects all"

Now the main ("work") branch has the update and you need to get it in each
of the other hosts (X, Y, Z, etc). You would go into each of these and merge
from the main ("work") into the new branches (X,Y,Z, etc).

$ cd ../Xspecific
$ bzr merge ../work
$ commit -m"Merged change from 'work' branch"

You would do that to each branch.

I'm not exactly and expert in bzr, so there is very possibly a better work
flow, but this should work. I would also look into the "pipes" and "loom"
plugins. They are specifically designed to deal with "upstream" changes,
which is basically what you are talking about. Hopefully someone here can
explain those better.

I hope this at least opens some doors for you, and opens others for
more knowledgeable people to comment.