[cvsnt] Unusual branching / merging problem

Harrison, Andrew andy.harrison at anite.com
Wed Nov 10 15:50:56 GMT 2004


Community technical support mailing list was retired 2010 and replaced with a professional technical support team. For assistance please contact: Pre-sales Technical support via email to sales@march-hare.com.


Having looked into it some more, I've finally worked out what happened. It's
definitely a user problem, but I'm not sure that CVS has handled it
correctly.

Basically the user did two merges (update -j) *without committing in
between*. The problem was caused by a file that didn't exist when he created
his branch, existed on the merge-from branch at the first merge, and was
modified on the merge-from branch between the two merges. When the user did
the second merge, cvs picked up the wrong revisions to do the merge. I guess
this is because the file exists in the sandbox but not in the repository for
that branch.

I know that this is a really obscure case, but it happened to us so others
might be affected too. The problem is that there is no easy way of detecting
or fixing the problem.

This can all be reproduced by the following sequence (using an existing
module called cvstest):


rem ### User 1 creates a branch
mkdir User1
cd User1
cvs checkout -P cvstest 
cd cvstest
cvs tag -b SubBranch1
cvs update -r SubBranch1

rem ### User 2 creates a branch
cd ..\..
mkdir User2
cd User2
cvs checkout -P cvstest 
cd cvstest
cvs tag -b SubBranch2
cvs update -r SubBranch2

rem ### User 2 creates a file and merges into trunk
echo "File created on Branch 2" > testfile.txt
cvs add testfile.txt
cvs commit -m "Created" testfile.txt

cvs update -A -C
cvs update -jSubBranch2
cvs commit -m "Merge Branch 2 -> Trunk" testfile.txt


rem ### User 1 merges from trunk *but doesn't commit*
cd ..\..\User1\cvstest
cvs update -jHEAD

rem ### User 2 creates another branch
cd ..\..\User2\cvstest
cvs update -A -C
cvs tag -b SubBranch3
cvs update -r SubBranch3

rem ### User 2 modifies the file and merges into trunk
echo "File modified on Branch 3" > testfile.txt
cvs commit -m "Modified" testfile.txt

cvs update -A -C
cvs update -jSubBranch3
cvs commit -m "Merge Branch 3 -> Trunk" testfile.txt

rem ### User 1 merges again from trunk and now commits
rem ### Note the revision numbers used in the merge
rem ### "Merging differences between 1.3 and 1.3 into testfile.txt" should
be
rem ### "Merging differences between 1.2 and 1.3 into testfile.txt"
cd ..\..\User1\cvstest
cvs update -jHEAD
cvs commit -m "Merged Trunk -> Branch 1" testfile.txt

rem ### The file contains the wrong data - 1.2 instead of 1.3
cat testfile.txt

Regards,
Andy

--
Andy Harrison - Platform Software Engineer 
Anite Telecoms Ltd. 127 Fleet Road, Fleet, Hampshire, GU51 3QN, UK
"No matter how bad things seem... 
...nothing could be worse than being used as a towel rail." - A.A. Milne


Scanned for viruses by MessageLabs. The integrity and security of this message cannot be guaranteed. This email is intended for the named recipient only, and may contain confidential information and proprietary material. Any unauthorised use or disclosure is prohibited.


More information about the cvsnt mailing list
Download the latest CVSNT, TortosieCVS, WinCVS etc. for Windows 8 etc.
@CVSNT on Twitter   CVSNT on Facebook