[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Merge and reverse merge dont seem to cancel out

From: Karl Fogel <kfogel_at_red-bean.com>
Date: Tue, 22 Jul 2008 12:16:13 -0400

JetMark <extrapic_at_extrapic.com> writes:
> If I do
> svn merge -r12:13 repository/branch
> A f1
> A f2
> A f3
>
> I get the addition of 3 files - exactly what I expected in the
> circumstances.
>
> but if I now do
>
> svn merge -r13:12 repository/branch
> I get
> Skipped 'f1'
> Skipped 'f2'
> Skipped 'f3'
>
> (And the files are not removed in the working copy.)
> It seems that the unmerge does not manage to undo a merge. What else do you
> have to do to ensure that this happens ?
>
> Can anyone say what I am doing wrong?

I'm surprised -- I would also think this should work the way you expect.
I've written a script to demonstrate this bug along with a few more
surprising things:

--------------------------------------------------------------------------
#!/bin/sh

# The next line is the only line you should need to adjust.
SVNDIR=/home/kfogel/src/subversion

SVN=${SVNDIR}/subversion/svn/svn
SVNSERVE=${SVNDIR}/subversion/svnserve/svnserve
SVNADMIN=${SVNDIR}/subversion/svnadmin/svnadmin

# Select an access method. If svn://, the svnserve setup is
# handled automagically by this script; but if http://, then
# you'll have to configure it yourself first.
#
# URL=http://localhost/SOMETHING/repos
# URL=svn://localhost/repos
URL=file:///`pwd`/repos

rm -rf repos wc trunk-wc branch-wc import-me

${SVNADMIN} create repos

# These are for svnserve only.
echo "[general]" > repos/conf/svnserve.conf
echo "anon-access = write" >> repos/conf/svnserve.conf
echo "auth-access = write" >> repos/conf/svnserve.conf

# The server will only be contacted if $URL is svn://foo, of course.
${SVNSERVE} --pid-file svnserve-pid -d -r `pwd`
# And put the kill command in a file, in case need to run it manually.
echo "kill -9 `cat svnserve-pid`" > k
chmod a+rwx k

echo "### Making a Greek Tree for import..."
mkdir import-me
mkdir import-me/trunk
mkdir import-me/tags
mkdir import-me/branches
mkdir import-me/trunk/A
mkdir import-me/trunk/A/B/
mkdir import-me/trunk/A/C/
mkdir import-me/trunk/A/D/
mkdir import-me/trunk/A/B/E/
mkdir import-me/trunk/A/B/F/
mkdir import-me/trunk/A/D/G/
mkdir import-me/trunk/A/D/H/
echo "This is the file 'iota'." > import-me/trunk/iota
echo "This is the file 'A/mu'." > import-me/trunk/A/mu
echo "This is the file 'A/B/lambda'." > import-me/trunk/A/B/lambda
echo "This is the file 'A/B/E/alpha'." > import-me/trunk/A/B/E/alpha
echo "This is the file 'A/B/E/beta'." > import-me/trunk/A/B/E/beta
echo "This is the file 'A/D/gamma'." > import-me/trunk/A/D/gamma
echo "This is the file 'A/D/G/pi'." > import-me/trunk/A/D/G/pi
echo "This is the file 'A/D/G/rho'." > import-me/trunk/A/D/G/rho
echo "This is the file 'A/D/G/tau'." > import-me/trunk/A/D/G/tau
echo "This is the file 'A/D/H/chi'." > import-me/trunk/A/D/H/chi
echo "This is the file 'A/D/H/omega'." > import-me/trunk/A/D/H/omega
echo "This is the file 'A/D/H/psi'." > import-me/trunk/A/D/H/psi
echo "### Done."
echo ""
echo "### Importing it..."
(cd import-me; ${SVN} import -q -m "Initial import." ${URL})
echo "### Done."
echo ""

${SVN} cp -q -m "Create a branch." ${URL}/trunk ${URL}/branches/mybranch

${SVN} co -q ${URL}/trunk trunk-wc
${SVN} co -q ${URL}/branches/mybranch branch-wc

cd branch-wc
echo "New file 1." > newfile1
echo "New file 2." > newfile2
echo "New file 3." > newfile3
${SVN} add -q newfile*
${SVN} ci -q -m "Add three new files in r3."
cd ..

cd trunk-wc
echo "### Merge the branch change (three added files in r3) into trunk..."
${SVN} merge -r2:3 ${URL}/branches/mybranch
echo ""
echo "### Now try to un-merge that not-yet-committed merge..."
${SVN} merge -r3:2 ${URL}/branches/mybranch
echo ""
echo "### Hmmm, look how 'svn status' still shows the local adds:"
${SVN} status
echo ""
echo "### Hmmm. Okay, what if we commit the result of the merge..."
${SVN} ci -m "Merged r3 from mybranch to trunk."
echo ""
echo "### ...and then un-merge? Nope, still no effect (but no Skips either):"
${SVN} merge -r3:2 ${URL}/branches/mybranch
echo ""
echo "### And 'svn status' shows that un-merging changed nothing:"
${SVN} status
echo ""
echo "### So what if we update the whole trunk working copy first..."
${SVN} up
echo ""
echo "### ...and then try un-merging again? Nope, still no effect..."
${SVN} merge -r3:2 ${URL}/branches/mybranch
echo ""
echo "### ...but now 'svn status' shows property mods:"
${SVN} status
echo ""
echo "### I'll bet those are svn:mergeinfo changes, right? Let's see:"
${SVN} diff
echo ""
echo "### Yup. So let's get this straight: when we reverse-merged before"
echo "### updating, no output was shown at merge time, and there was no effect"
echo "### in the working copy. Then after we updated, reverse-merging still"
echo "### showed no output, and still didn't remove the files as it should,"
echo "### but it did affect their svn:mergeinfo properties."
echo "###"
echo "### This is so messed up."
echo ""
cd ..

# Put kill command in a file, in case need to run it manually.
echo "kill -9 `cat svnserve-pid`" > k
chmod a+rwx k
./k

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: users-help_at_subversion.tigris.org
Received on 2008-07-22 18:16:39 CEST

This is an archived mail posted to the Subversion Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.