Re re: About merging

Erik Bågfors zindar at gmail.com
Thu Jun 16 23:08:25 BST 2005


I assume that in this example... 1 and 2 are two different branches
and that they have no common history.  You simply did "bzr init" in
both directories, added the files and commited.

That means that bzr has no way of knowing that file1.php in 1 and
file1.php in 2 is the same file.  After all, the filename is in no way
an indication that the files are the same.

bzr keeps a generated id for each file. That's the identifier for the file.

So what happens when you try to merge is that bzr looks for changes
since the last common point (never in your example).  In 1, you added
file1.php, then bzr tries to do the same in 2, but since file1.php
already exists, you get a conflict.

So... what you want to do is this.  In 1, you go "bzr init; bzr add .;
bzr commit -m 'added files'".

Then you do "bzr branch 1 2".

Then you move 2 to another computer.  Now you can edit it, commit,
move back the directory to the first computer and merge.

Hope this helps, 

Regards,
Erik



On 6/16/05, Thibault North <tnorth at bluewin.ch> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Hello,
> I am sorry this is not a patch or a contribution ... (yet ?) but a
> simple question about merging, one more time :)
> 
> I tried this on 2 directories :
> I have :
> 
> 1/
>         file1.php
>         file2.php
>         file3.php
> And
> 2/
>         file1.php
>         file2.php
>         file3.php
> 
> Which contains the same thing. Both are commited, separately.
> Now let's suppose 2/ is on a laptop and someone works on it. He commits
> changes into 2/, modifing files and adding test into file2 and 3. File3
> is empty now.
> 
> Then, back home with the othe computer which contains 1/, he makes
> changes on file3. and adds some text. Commit.
> 
> Good. Now he has two different versions, each having new commits.
> Last thing to do is to copy file from laptop to other computer and merge.
> He has now 1/ and 2/ on the computer. in a same directory.
> Let's merge 2/ into 1/ :
> $> cd 1/
> $> bzr merge ../2 .
> bzr: error: file1.php is already versioned
>   at /home/tnorth/bazaar-ng/bzr.dev/bzrlib/errors.py:41 in bailout()
>   see ~/.bzr.log for debug information
> 
> Now the question is : what's that error ?
> Is my merge command correct ?
> If so, why is file3.php empty, if a patch was commited in 1/ to add
> stuff after the commit in 2/ which had it empty ?
> 
> Using bzr 0.0.4.
> 
> I would really be pleased to know what I did wrong...
> Thanks a lot,
> Regards,
> TNorth
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.1 (GNU/Linux)
> 
> iD8DBQFCsdtu6Xb3bo96D2URArUDAJ0dPPSWoZgdUN84CF0r2iAtZT/TbwCfbMgn
> Wdih59w9M85JnI3wqbft6Rc=
> =zdrJ
> -----END PGP SIGNATURE-----
> 
>




More information about the bazaar mailing list