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

Double file entries in repository after merge of changes (moved file) from one branch to another

From: Hermanns, Horst <h.hermanns_at_telekom.de>
Date: Fri, 19 Jun 2009 14:08:31 +0200


we still could not solve a problem already discussed under:

I could not find a similar problem in the bug tracker, so I would like
to ask a developer to have a look on it.

We merged changes (creation and move of a file) from one branch to
another. Due to our mergeinfo properties we divided the merge in two
merge steps/rev-ranges (without commit in between). Afterwards we
committed the result of both merges.

Example (Test Script see below):
 - Branch1, Create dir1 with file1 -> commit/Rev1
 - Branch1, Create dir2 in dir1 and mv file1 to dir2 -> commit/Rev2

 - Branch2, svn merge -r....:Rev1 <Branch1> .
 - Branch2, svn merge -rRev1:Rev2 <Branch1> .
 - Branch2, svn ci ...

Due to status/commit/log output and WC everythings fine (finally only
one file 'file1' in dir2 was shown), but after commit in the repository
the file 'file1' is located in old and new directory. A new checkout
contains file1 at both locations.

The problem occurcs only if we merge in 2 steps and don't commit between
the both steps.
Is this procedure ok or do we have to commit between each merge? I
thought 'svn merge' also splits rev ranges depending on the mergeinfo

We tested this behavior in several environments:
        SVN Client, 1.5.6/1.6.2 (Windows JavaHL, precompiled Tigris.org
Apache 2.2)
        SVN Server, 1.5.5/1.6.2 (Linux-Server, compiled with gcc 4.1.0,
Apache 2.2.11 with mod_dav_svn)
        Repository format FSFS

Any suggestions?

Thanks and regards,

------ Test-script -------

SVN=`which svn`
SVNSERVE=`which svnserve`
SVNADMIN=`which svnadmin`

# URL=svn://localhost/repos
# URL=file:///`pwd`/repos

##rm -rf repos wc import-me

##${SVNADMIN} create repos

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 ""

# test case
# create two branches
${SVN} mkdir -m "new Branch A" ${URL}/branches/A
${SVN} mkdir -m "new Branch B" ${URL}/branches/B

# Create changes in Branch A
${SVN} co -q ${URL}/branches/A wcA
cd wcA
svn mkdir dir1

cd dir1
touch file1
svn add file1

cd ..
svn ci -m "Commit new dir1/file1 Branch A" .

cd dir1
svn mkdir dir2
svn mv file1 dir2

cd ..
svn ci -m"relocated file1 to dir2 in BranchA" .

# Merge changes from Branch A to Branch B
cd ..
${SVN} co -q ${URL}/branches/B wcB
cd wcB

endRev=`svn info | grep Revision: | awk -F ' ' '{print $2}'`
midRev=`expr $endRev - 1`
startRev=`expr $endRev - 2`

svn merge --force -r${startRev}:${midRev} ${URL}/branches/A .

svn merge --force -r${midRev}:${endRev} ${URL}/branches/A .

echo ""
echo "Status:"
svn status

svn ci -m "Commit merge results to Branch B" .

echo ""
echo "Log, should only have one entry for file1"
svn log -rHEAD -vq

#List Merge Results
echo ""
echo "old location dir1, there should be no file1"
svn list ${URL}/branches/B/dir1

echo "new location dir1/dir2, there should be a file1"
svn list ${URL}/branches/B/dir1/dir2

------ Test Output ------
### Making a Greek Tree for import...
### Done.

### Importing it...
### Done.

Committed revision 2.

Committed revision 3.
A dir1
A file1
Adding dir1
Adding dir1/file1
Transmitting file data .
Committed revision 4.
A dir2
A dir2/file1
D file1
Adding dir1/dir2
Adding dir1/dir2/file1
Deleting dir1/file1

Committed revision 5.
--- Merging r4 into '.':
A dir1
A dir1/file1
--- Merging r5 into '.':
A dir1/dir2
A dir1/dir2/file1
D dir1/file1 !!! Delete, seems to be ok

 M .
A + dir1
A + dir1/dir2
A + dir1/dir2/file1
Sending .
Adding dir1
Adding dir1/dir2
Adding dir1/dir2/file1

Committed revision 6.

Log, should only have one entry for file1 !!! Log ok, no dir1/file1
r6 | h.hermanns | 2009-06-19 12:01:38 +0200 (Fri, 19 Jun 2009)
Changed paths:
   M /branches/B
   A /branches/B/dir1 (from /branches/A/dir1:4)
   A /branches/B/dir1/dir2 (from /branches/A/dir1/dir2:5)
   R /branches/B/dir1/dir2/file1 (from /branches/A/dir1/dir2/file1:5)

old location, there should be no file1
file1 !!! file1 in old
location dir1/file1
new location, there should be a file1

Received on 2009-06-19 14:40:52 CEST

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

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