Working on several branches at the same time

David Cournapeau david at ar.media.kyoto-u.ac.jp
Mon Jun 16 16:58:24 BST 2008


James Westby wrote:
>
> No, you should only have one real "fix bug" entry in the log. What you
> will have though is more than one merge commit related to this process.

I guess I am confused by "fix bug" entry in the log. When I merge 
branches, I am trying to avoid merge 'bla bla' now, because it is not 
helpful. Instead, I just describe the work done in the merge. In that 
case, I will have two fix bug: one in the mainline commit, one in the 
merged branch commit.

bzr branch mainline fixbug
cd fix bug
bla bla
bzr ci -m "Fix bug 1."
cd mainline
bzr merge ../fixbug
bzr ci -m "Fix bug 1."

Now, to avoid this, I could do a pull. But then, the difference between 
pull and merge would be whether I have one commit for the fixbug branch, 
or several, which does not sound quite right (if I have several commits 
in the fixbug branch, then no commit will be fix bug, but more detailed, 
likely because the bug was big).

Also, here is what I have in the full process (this creates the project 
in tmp)

mkdir tmp
cd tmp
# Create mainline
mkdir mainline
(cd mainline && bzr init)
(cd mainline && touch foo.txt)
(cd mainline && bzr add .)
(cd mainline && bzr ci -m "Start foo project")
# Start new feat
bzr branch mainline newfeat
(cd newfeat && echo 'new feat' > foo.txt)
(cd newfeat && bzr ci -m "Start new feat.")
# Arg, bug, stop working on new feat
bzr branch mainline fixbug
(cd fixbug && echo 'Fix mainline' > foo.txt)
(cd fixbug && bzr ci -m "Fix bug 1.")
# Merge bug fix into mainline
(cd mainline && bzr merge ../fixbug)
(cd mainline && bzr ci -m "Fix bug 1.")
# Merge bug fix into newfeat
(cd newfeat && bzr merge ../mainline)
(cd newfeat && bzr ci -m "Fix bug 1.")

If I use slog (my alias for log --short  --forward) in newfeat, then it 
looks OK:

    1 David Cournapeau  2008-06-17
      Start foo project

    2 David Cournapeau  2008-06-17
      Start new feat.

    3 David Cournapeau  2008-06-17 [merge]
      Fix bug 1.

But the log is ugly:
------------------------------------------------------------
revno: 3
committer: David Cournapeau <david at ar.media.kyoto-u.ac.jp>
branch nick: newfeat
timestamp: Tue 2008-06-17 00:53:08 +0900
message:
  Fix bug 1.
    ------------------------------------------------------------
    revno: 1.2.1
    committer: David Cournapeau <david at ar.media.kyoto-u.ac.jp>
    branch nick: mainline
    timestamp: Tue 2008-06-17 00:52:37 +0900
    message:
      Fix bug 1.
    ------------------------------------------------------------
    revno: 1.1.1
    committer: David Cournapeau <david at ar.media.kyoto-u.ac.jp>
    branch nick: fixbug
    timestamp: Tue 2008-06-17 00:52:37 +0900
    message:
      Fix bug 1.
------------------------------------------------------------
revno: 2
committer: David Cournapeau <david at ar.media.kyoto-u.ac.jp>
branch nick: newfeat
timestamp: Tue 2008-06-17 00:52:36 +0900
message:
  Start new feat.
------------------------------------------------------------
revno: 1
committer: David Cournapeau <david at ar.media.kyoto-u.ac.jp>
branch nick: mainline
timestamp: Tue 2008-06-17 00:52:35 +0900
message:
  Start foo project


> If you do not want these merge commits then rebase is the way to do it,
> yes, but the merge commits shouldn't cause you any problems.

I was wondering whether it was possible to have the best of both words: 
nice history, and "works at every commit" bzr behavior. Now that I think 
about it, it sounds difficult, even antinomic ?

cheers,

David



More information about the bazaar mailing list