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

Merge bug -- svn:keywords and conflict resolution

From: Varnau, Steve (Seaquest R&D) <steve.varnau_at_hp.com>
Date: Mon, 26 Mar 2012 17:26:18 +0000

Hello,

We had some developers changing svn:keywords property, which caused merge conflicts for other people pulling in the changes via sync merges. The developers merging the change into their branch were surprised to get merge conflicts in files they had not changed.

I figured out that svn merge was actually correct in flagging a conflict, but does not present the conflicting lines correctly. The presentation is not correct, since what is shown in the merged file as the right side of the merge does not match the file.merge-right.rREV file.

We noticed the behavior in 1.7.3 command-line client on Linux, then reproduced it in 1.7.4 command-line on Windows. I could not find a relevant bug in the issues list.

I admit that the scenario to get to the incorrect behavior is not something one would normally do intentionally. It involves removing a keyword from the svn:keywords property, while leaving the expanded keyword in the contents of the file.

Shell script to reproduce is below.

-Steve

REPO=file:///work/repo
svn co $REPO/trunk trunk
cd trunk
echo '$Date$ $Revision$' > keyfile
svn add keyfile
svn propset svn:keywords 'Date Revision' keyfile
svn ci -m 'initial keyfile'
svn up
cat keyfile # expanded keywords

cd ..
svn cp -m "side branch" $REPO/trunk $REPO/branches/br1
svn co $REPO/branches/br1 br1

cd trunk
echo " some changes" >> keyfile
svn ci -m "new content"

cd ../br1
svn merge ^/trunk
svn ci -m "sync merge"
svn up

cd ../trunk
svn propset svn:keywords 'Id' keyfile # whoops, inadvertantly replaced Date and Revision
echo '$Id$' >> keyfile
svn ci -m "chg for Id keyword"

cd ../br1
svn merge --accept postpone ^/trunk
# second sync merge flags a conflict
# since the Date and Revision keywords are being removed from svn:keywords
# Should the file content show the line from trunk (r6) or from branch (r5)

### Here's the bug -- why do both sides of conflict show same content?
cat keyfile
<<<<<<< .working
$Date: 2012-03-26 10:09:19 -0700 (Mon, 26 Mar 2012) $ $Revision: 5 $
=======
$Date: 2012-03-26 10:09:19 -0700 (Mon, 26 Mar 2012) $ $Revision: 5 $
>>>>>>> .merge-right.r6
 some changes
$Id$

### If we look at merge files, we see a different story
cat keyfile.working
$Date: 2012-03-26 10:09:19 -0700 (Mon, 26 Mar 2012) $ $Revision: 5 $
 some changes

cat keyfile.merge-left.r4
$Date$ $Revision$
 some changes

cat keyfile.merge-right.r6
$Date: 2012-03-26 10:09:18 -0700 (Mon, 26 Mar 2012) $ $Revision: 4 $
 some changes
$Id: keyfile 5 2012-03-26 17:09:19Z svarnau $
Received on 2012-03-26 19:27:11 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.