Re: [AD] Subversion

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


Elias Pschernig wrote:
 * revision 100: branch is created from trunk
 * revision 101: trunk/a.txt is edited
 * revision 102: branch/a.txt is renamed to branch/b.txt

If you try to merge revision 102 from branch to trunk, then trunk/a.txt will be replaced by branch/b.txt, undoing the modifications from revision 101 ! This is because revision 102 contains a copy and a delete rather than a rename.

Here it just says:

Skipped missing target: 'b.txt'
A    a.txt

And doesn't actually modify anything as well.

I think you missed something, because that's not what's supposed to happen (I checked :-). This looks suspicious because b.txt is not a "target" of revision 102, but rather its result. Also a.txt is not supposed to be "A"dded in revision 102... What command did you use ?

But, I think the case we will have in Allegro is like this:
"branch" is the 4.2.x, "trunk" 4.3.x (or any other directory names)

* revision 101: trunk/a.txt is renamed to b.txt
* revision 102: trunk/b.txt is modified

And now, you can simply merge the changes from trunk to the 4.2.0
branch. (Either including or excluding the name change, depending on
which revisions you specify.)

Attached is a shell script that shows that this unfortunately won't work. If you merge without the rename, svn complains. If you merge with the rename, you fall back to the situation I described in the previous mail where you lose all modifications on the branch :-(

Note: the script was made using the MSys shell under windows, so it might need adjusting under Linux. Also beware, it contains two "rm -rf" at the beginning :-)

--
Julien Cugnière

#!/bin/sh

rm -rf repo
rm -rf wc

svnadmin create repo
svn co file://`pwd`/repo wc
cd wc


echo -e "\n=== r1: Creation of the trunk"
mkdir trunk
echo Foo > trunk/a.txt
svn add trunk
svn commit -m "creation of the trunk"


echo -e "\n=== r2: Creation of the branch from the trunk"
svn cp trunk branch
svn commit -m "creation of the branch"


echo -e "\n=== r3: Renaming trunk/a.txt to trunk/b.txt"
svn mv trunk/a.txt trunk/b.txt
svn commit -m "trunk/a.txt renamed to trunk/b.txt"


echo -e "\n=== r4: Add 'Bar' to trunk/b.txt"
echo Bar >> trunk/b.txt
svn commit -m "added Bar to trunk/a.txt"


echo -e "\n=== Trying to merge revision 4 from the trunk to the branch"
svn merge -r 3:4 trunk branch
echo "Failed :-("


echo -e "\n=== Trying to merge revision 3 and 4 from the trunk to the branch"
svn merge -r 2:4 trunk branch
echo "cat branch/b.txt"
cat branch/b.txt
echo "Looks like a success (but is it really?)"
echo "Reverting..."
svn revert -R .
rm branch/b.txt


echo -e "\n=== r5: Add 'Arg' to branch/a.txt"
echo Arg >> branch/a.txt
svn commit -m "add Arg to branch/a.txt"


echo -e "\n=== Trying to merge revision 3 and 4 from the trunk to the branch"
svn merge -r 2:4 trunk branch
echo "cat branch/b.txt"
cat branch/b.txt
echo "Ooops, the merge succeeded, but didn't do quite what we were expecting:"
echo "The modifications on the branch from r5 are now lost :-("


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/