Fwd: Nubee question

Gary van der Merwe garyvdm at gmail.com
Thu Jul 23 04:42:34 BST 2009

Copping ml.

---------- Forwarded message ----------
From: Gary van der Merwe <garyvdm at gmail.com>
Date: Thu, Jul 23, 2009 at 4:22 AM
Subject: Re: Nubee question
To: Simon <greminn at gmail.com>

On Thu, Jul 23, 2009 at 2:26 AM, Simon<greminn at gmail.com> wrote:
> Hi There,
> We develop php based applications. Up to now we have had one branch and just
> worked on code within the development server in that branch. Now we have two
> branches and are investigating working with bazaar - but cant quite get our
> heads around it.

You have come to the right place. Bazaar (or other dvcs's like hg or
git), but especially Bazaar ;-), is just the right tool for this.

> Currently we have a debian etch server at each branch that is bascially
> apache/php/mysql. The users within the branch connect via samba and make the
> changes to the projects.. then we are manually merging the two at out
> "staging" server at our data centre. phew.
> What i imaging would work for us is: 1 x central server (bzr) at our data
> centre (setup just for bazaar) and a development web server at each branch
> (dev1 and dev2). We have no problem with working on files among the users at
> each branch and dont want to go to the stage of managing that (yet)... we
> just really want each branch to be able to work on the files for each
> project thruout the day, then merge them back into the central server at the
> end of each day... etc etc until the project is completed...
> We have looked thru the docs and cant quite get our head around how this
> should work.. does anyone have any links to a good howto for this.. or are
> we thinking about this the wrong way?

Make sure that you have read Chapter 1* and 2.7#

* http://doc.bazaar-vcs.org/latest/en/user-guide/index.html#getting-started
# http://doc.bazaar-vcs.org/latest/en/user-guide/index.html#bazaar-zen

How ever - I think it would help if I gave you some pointers. I'm
basing all of this advice on the assumption that you are not currently
using any other vcs. If you are, things are a bit different.

The first thing you need to do is create a initial branch for dev1,
and dev2, and do an initial merge of the two into the "integration"
branch (as you called the "staging" branch.)

First start with dev1:
~ $ cd dev1
~/dev1 $ bzr init
Created a standalone tree (format: xxx)
~/dev1 $ bzr add
adding bar
adding foo
~/dev1 $ bzr commit -m "Initial commit of dev1."
Committing to: ~/dev1/
added bar
added foo
Committed revision 1.

Then do a similar thing with dev2. But when we add the files, we want
to reuse the file-ids from dev1, which makes it possible for bzr to
merge later.
~ $ cd dev2
~/dev2 $ bzr init
Created a standalone tree (format: xxx)
~/dev2 $ bzr add --file-ids-from=~/dev1  # -------------------->
--file-ids-from very important
adding bar w/ file id from bar
adding ham
~/dev2 $ bzr commit -m "Initial commit of dev2."
Committing to: ~/dev2/
added bar
added ham
Committed revision 1.

Now you need to do an initial merge of dev1 and dev2 into integration.
You should either do this in a separate folder from you current
staging folder, or do it in place, but move the existing copy out
first. For the example I give, I'll be doing it in a separate folder.

~ $ bzr branch dev1 intrg
Branched 1 revision(s).
~ $ cd intg
~/intrg $ bzr merge ~/dev2 -r 0..-1
+N  ham
 M  bar
Text conflict in bar
1 conflicts encountered.

As you can see, bar existed in both branches, and when bzr tried to
merge, there were conflicts that needed to merge resolve by hand. You
may want to just copy over your allready merged files from staging.
I'm going to resolve the conflicts using meld:

~/intrg $ meld bar.THIS bar bar.OTHER
~/intrg $ bzr resolve
All conflicts resolved.
~/intrg $ bzr commit -m "Initial merge"
Committing to: ~/intrg/
modified bar
added ham
Committed revision 2.

If you now run qlog, you should see something like this:

More information about the bazaar mailing list