merge with no changes?

Neil Martinsen-Burrell nmb at wartburg.edu
Thu Jun 25 16:29:04 BST 2009


Parth Malwankar wrote:
> While working on some branches which I merge frequently
> I observed that a merge happens even that there are no
> (visible?) changes.
>
> So for example, I could merge A->B and B->A forever
> as the merge _always_ happens. I was wondering if this
> is expected behavior or there is something I need to better
> understand here.

A merge creates a new revision whose parents are the tip of the current 
branch and the tip of the other branch.  When you merge repeatedly like 
this, you continue making new revisions with each commit which then need 
to be merged to the other branch.  I believe the graph would look 
something like this

A   "Initial"
|\
B | "Added x"
|\|
| C "Merge from bar"
|/|
D | "Merge from foo"
|\|
| E "Merge from bar"

and so on.  Using ``bzr qlog`` from the qbzr plugin should show you this 
structure of revisions.

-Neil

> [bzrtest]% bzr init --1.9-rich-root foo
> Created a standalone tree (format: 1.9-rich-root)
> [bzrtest]% cd foo
> [foo]% touch hello world
> [foo]% bzr add .
> adding hello
> adding world
> [foo]% bzr ci -m "initial"
> Committing to: /home/parthm/tmp/bzrtest/foo/
> added hello
> added world
> Committed revision 1.
> [foo]% cd ..
> [bzrtest]% ls
> foo/
> [bzrtest]% bzr branch foo bar
> Branched 1 revision(s).
> [bzrtest]% cd bar
> [bar]% bzr st
> [bar]% bzr merge ../foo
> Nothing to do.
> [bar]% cd ../bar
> [bar]% cd ../foo
> [foo]% bzr merge ../bar
> Nothing to do.
> [foo]% cd ../bar
> [bar]% touch x
> [bar]% bzr add x
> adding x
> [bar]% bzr ci -m "added x"
> Committing to: /home/parthm/tmp/bzrtest/bar/
> added x
> Committed revision 2.
> [bar]% cd ../foo
> [foo]% bzr merge ../bar
> +N  x
> All changes applied successfully.
> [foo]% bzr st
> added:
>    x
> pending merge tips: (use -v to see all merge revisions)
>    parth.malwankar at g... 2009-06-25 added x
> [foo]% bzr ci -m "merge from bar"
> Committing to: /home/parthm/tmp/bzrtest/foo/
> added x
> Committed revision 2.
> [foo]% cd ../bar
> [bar]% bzr st
> [bar]% bzr merge ../foo
> All changes applied successfully.
> [bar]% bzr st
> pending merge tips: (use -v to see all merge revisions)
>    parth.malwankar at g... 2009-06-25 [merge] merge from bar
> [bar]% bzr ci -m "merge from foo"
> Committing to: /home/parthm/tmp/bzrtest/bar/
> Committed revision 3.
> [bar]% cd ../foo
> [foo]% bzr merge ../bar
> All changes applied successfully.
> [foo]% bzr st
> pending merge tips: (use -v to see all merge revisions)
>    parth.malwankar at g... 2009-06-25 [merge] merge from foo
> [foo]% bzr cdiff
> [foo]% bzr ci -m "merge from bar"
> Committing to: /home/parthm/tmp/bzrtest/foo/
> Committed revision 3.
> [foo]% cd ../bar
> [bar]% bzr st
> [bar]% bzr merge ../foo
> All changes applied successfully.
> [bar]% bzr diff
> [bar]% bzr ci -m "merge from foo"
> Committing to: /home/parthm/tmp/bzrtest/bar/
> Committed revision 4.
> [bar]% bzr st
> [bar]% bzr merge ../foo
> Nothing to do.
> [bar]% cd ../foo
> [foo]% bzr merge ../foo
> Nothing to do.
> [foo]% bzr merge ../bar
> All changes applied successfully.
> [foo]% bzr st
> pending merge tips: (use -v to see all merge revisions)
>    parth.malwankar at g... 2009-06-25 [merge] merge from foo
> [foo]% bzr diff
> [foo]%




More information about the bazaar mailing list