About merging

Aaron Bentley aaron.bentley at utoronto.ca
Tue May 31 18:18:48 BST 2005


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

John A Meinel wrote:
|>In fact, I cannot well understand when merging may be an amazing way
to put
|>a stable and unstable version together...

One point you may be missing is that merges (as currently implemented in
bzr) are three-way operations.

There's your version("MINE"), there's the version you want to
merge("OTHER"), and there's the original copy that both of you started
from("BASE").  The tool we use for doing merges on text files is the
standard diff3.

diff3 is a merge tool for lines in text files, which happens to work
very well with source code.  Other tools exist that do merges (1) using
a different technique (e.g. wiggle), or based on different knowledge of
the format (e.g. xmlmerge).

The diff3 merge operation keeps all changes that MINE made to BASE,
keeps all changes that both MINE and OTHER made to BASE, and adds the
changes that OTHER made to BASE.  Where MINE and OTHER made different
changes to BASE, diff3 considers that a conflict.

| It just depends how incompatible they are. If the development is done
| well, with good separation between interfaces, and just the internals
| change, then there is little difficulty with merging. If things are very
| interconnected, then yes, merging can't help much.

In general, it's also a good practice to merge stable into unstable
frequently, because that means that BASE is more recent, which reduces
the likelihood of conflicts.  bzr doesn't have good support for frequent
merging, but it will soon.

|>Could someone please tell me what I didn't understand ? I never tried to
|>merge anything with any SCM, so no idea what may happen... if I try it
with
|>bzr and it fails, may I know where ?
|
|
| I believe bzr leaves conflict markers in the source file (similar to how
| cvs does it), I'm not sure if it leaves anything else, though.

It will also dump three copies of the source file, named foo.BASE,
foo.OTHER and foo.THIS.

A patch is pending to have merge report conflicts as they happen.

Aaron
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFCnJx40F+nu1YWqI0RAnpCAJ9GfZpaajDI5PABWmJTgX197NPTNQCcD7mv
0xXHfbPZd6yZSB+7yTyLoWM=
=ssYR
-----END PGP SIGNATURE-----




More information about the bazaar mailing list