From: "Cameron, Steve" To: "'bug-cvs@prep.ai.mit.edu'" Subject: cvs update -d dir doesn't set sticky tags for dir. Date: Mon, 15 Dec 1997 14:53:26 -0600 >Submitter-Id: net >Originator: Steve Cameron >Organization: net >Confidential: no >Synopsis: cvs update -d executed on a branch doesn't set stickies. >Severity: serious >Priority: medium >Category: cvs >Class: sw-bug >Release: cvs-1.9 >Environment: SCO Openserver 5.0.2, System: SCO_SV alecia 3.2 2 i386 >Description: Related very closely to the problem of cvs update -j not setting sticky tags when merging to a branch. (Really part of same problem.) "cvs update -d dir" will create dir if dir has been added, say by another user, to the branch you're on, but, it will have no sticky tags. You might say, "that's how it's supposed to work.", but then, try this: cvs update -d file1 file2 dir Now, file1, file2 will be create with sticky tags, wherease dir and its contents will not. That doesn't seem right to me. You might ask, if this were to be fixed, what you would do if you really wanted the trunk files. In that case, you'd do this: cvs update -A -d dir >How-To-Repeat: mkdir b1a mkdir b1b cd b1b cvs checkout -r branch1 module cd .. cd b1a cvs checkout -r branch1 module cd module mkdir xxx cvs add xxx cd xxx echo xxx > xxx cvs add xxx cvs commit -m xxx cd ../../../b2a/module cvs update -d xxx cd xxx ls (what? no xxx file?) cat CVS/Tag (What? no CVS/Tag file?) >Fix: Here is an updated patch to update.c that fixes this update -d problem as well as fixing update -j so that merging to a branch causes directories to be created with the right sticky tags. (The patch applices to CVS 1.9) As always, no guarantees of correctness can be made, caveat emptor. (There were two prior versions of this patch, who's to say this is the last of the matter? ) [update.c patch snipped; there was another version later -kingdon] Here is an updated patch to sanity.sh: *** sanity.sh.orig Mon Dec 15 14:13:18 1997 --- sanity.sh Mon Dec 15 14:30:50 1997 *************** *** 448,454 **** # We also omit rdiff for now, because we have put off # committing the changes that make it work until after the 1.9 # release. ! tests="basica basicb basic1 deep basic2 death death2 branches multibranch import join new newb conflicts conflicts2 modules mflag errmsg1 devcom ignore binfiles binwrap info serverpatch log" else tests="$*" fi --- 448,454 ---- # We also omit rdiff for now, because we have put off # committing the changes that make it work until after the 1.9 # release. ! tests="basica basicb basic1 deep basic2 death death2 branches multibranch import join new newb conflicts conflicts2 modules mflag errmsg1 devcom ignore binfiles binwrap info serverpatch log b2bmrg" else tests="$*" fi *************** *** 566,571 **** --- 566,817 ---- CVS_SERVER=${testcvs}; export CVS_SERVER fi + test_branch_to_branch_merge() + { + # Assume the stuff that is tested elsewhere works. + # (this is probably bad form?) + + # This function tests the following: + # 1) "cvs update -d -r rev1 dir" creates dir + # and files in it with the sticky tag rev1 + # 2) "cvs update -d -j rev1 dir" creates dir + # and files in it with the same sticky tag as the parent dir + # into which the update is done. + # 3) "cvs update -d -r rev1 dir" updating trunk creates + # dir with sticky tag rev1 + # 4) "cvs update -d -j rev1 dir" updates trunk with + # no sticky tag. + # 5) "cvs update -d newdir" on branch gets sticky tag + # of dir from which update is done. + # 6) "cvs update -A -d newdir" on branch gets no sticky tag. + # 7) "cvs update -d newdir" on trunk gets no sticky tag + + # It does not test anything else. + + LFILE="/tmp/b2blf$$" + echo > "$LFILE" + + # Create a directory in the repository, first-dir + + mkdir ${CVSROOT_DIRNAME}/first-dir + mkdir b1 + mkdir b2 + mkdir trunk + cd trunk + + # Check out first-dir + ${testcvs} -q co first-dir >> "$LFILE" 2>&1 + + # make two branch tags, b1, b2 + cd first-dir + echo x > initfile + ${testcvs} add initfile >>"$LFILE" 2>&1 + ${testcvs} commit -m "add" >>"$LFILE" 2>&1 + ${testcvs} tag tag1 >>"$LFILE" 2>&1 + + cd .. + ${testcvs} rtag -b -r tag1 b1 first-dir >>"$LFILE" 2>&1 + ${testcvs} rtag -b -r tag1 b2 first-dir >>"$LFILE" 2>&1 + + cd .. + + cd b1 + ${testcvs} checkout -r b1 first-dir >>"$LFILE" 2>&1 + cd first-dir + echo "file 1" > file1 + echo "file 2" > file2 + mkdir dir1 + ${testcvs} add file1 file2 dir1 >>"$LFILE" 2>&1 + cd dir1 + echo "file 3" > file3 + ${testcvs} add file3 >>"$LFILE" 2>&1 + cd .. + ${testcvs} commit -m 'add' >>"$LFILE" 2>&1 + cd ../.. + cd b2 + ${testcvs} checkout -r b2 first-dir >>"$LFILE" 2>&1 + # + cd first-dir + dotest b2bmrg-1 "${testcvs} update -d -r b1 dir1" \ + 'cvs update: Updating dir1 + U dir1/file3' + dotest b2bmrg-2 "${testcvs} status" \ + '.*File: initfile Status: Up-to-date + + Working revision: 1.1 .* + Repository revision: 1.1 .* + Sticky Tag: b2 (branch: 1.1.4) + Sticky Date: (none) + Sticky Options: (none).* + File: file3 Status: Up-to-date + + Working revision: 1.1.2.1 .* + Repository revision: 1.1.2.1 .* + Sticky Tag: b1 (branch: 1.1.2) + Sticky Date: (none) + Sticky Options: (none).*' + + + /bin/rm -fr dir1 + dotest b2bmrg-3 "${testcvs} update -d -j b1 dir1" \ + 'cvs update: Updating dir1 + U dir1/file3' + dotest b2bmrg-4 "${testcvs} status" \ + 'cvs status: Examining . + =================================================================== + File: initfile Status: Up-to-date + + Working revision: 1.1 .* + Repository revision: 1.1 .* + Sticky Tag: b2 (branch: 1.1.4) + Sticky Date: (none) + Sticky Options: (none) + + cvs status: Examining dir1 + =================================================================== + File: file3 Status: Locally Added + + Working revision: New file! + Repository revision: No revision control file + Sticky Tag: b2 - MISSING from RCS file! + Sticky Date: (none) + Sticky Options: (none)' + + cd ../../trunk/first-dir + dotest b2bmrg-5 "${testcvs} update -d -P dir1" \ + 'cvs update: Updating dir1' + + dotest b2bmrg-6 "${testcvs} update -d -P -r b1 dir1" \ + 'cvs update: Updating dir1 + U dir1/file3' + dotest b2bmrg-7 "${testcvs} status" \ + 'cvs status: Examining . + =================================================================== + File: initfile Status: Up-to-date + + Working revision: 1.1 .* + Repository revision: 1.1 .* + Sticky Tag: (none) + Sticky Date: (none) + Sticky Options: (none) + + cvs status: Examining dir1 + =================================================================== + File: file3 Status: Up-to-date + + Working revision: 1.1.2.1 .* + Repository revision: 1.1.2.1 .* + Sticky Tag: b1 (branch: 1.1.2) + Sticky Date: (none) + Sticky Options: (none).*' + + /bin/rm -fr dir1 + dotest b2bmrg-8 "${testcvs} update -d -P -j b1 dir1" \ + 'cvs update: Updating dir1 + U dir1/file3' + dotest b2bmrg-9 "${testcvs} status" \ + 'cvs status: Examining . + =================================================================== + File: initfile Status: Up-to-date + + Working revision: 1.1 .* + Repository revision: 1.1 .* + Sticky Tag: (none) + Sticky Date: (none) + Sticky Options: (none) + + cvs status: Examining dir1 + =================================================================== + File: file3 Status: Locally Added + + Working revision: New file! + Repository revision: 1.1 .* + Sticky Tag: (none) + Sticky Date: (none) + Sticky Options: (none)' + + cd ../.. + /bin/rm -fr b1/first-dir + /bin/rm -fr b2/first-dir + + # create dirs b1a, b1b, checkout branch b1 into + # each dir. Create a new dir in b1a, commit, then + # do a "cvs update -d dir" in b1b, and see if the + # tags are right. + + mkdir b1a + mkdir b1b + cd b1b + ${testcvs} checkout -r b1 first-dir >>$LFILE 2>&1 + cd ../b1a + ${testcvs} checkout -r b1 first-dir >>$LFILE 2>&1 + cd first-dir + mkdir dirz + ${testcvs} add dirz >>$LFILE 2>&1 + cd dirz + echo "hello" > hello + ${testcvs} add hello >>$LFILE 2>&1 + cd .. + ${testcvs} commit -m 'dirz' >>$LFILE 2>&1 + cd ../../b1b/first-dir + dotest b2bmrg-10 "${testcvs} update -d dirz" \ + 'cvs update: Updating dirz + U dirz/hello' + cd dirz + dotest b2bmrg-11 "${testcvs} status" \ + 'cvs status: Examining . + =================================================================== + File: hello Status: Up-to-date + + Working revision: 1.1.2.1 .* + Repository revision: 1.1.2.1 .* + Sticky Tag: b1 (branch: 1.1.2) + Sticky Date: (none) + Sticky Options: (none)' + dotest b2bmrg-11a "cat CVS/Tag" 'Tb1' + cd .. + /bin/rm -fr dirz + dotest b2bmrg-12 "${testcvs} update -A -d dirz" \ + 'cvs update: Updating dirz' + cd dirz + dotest b2bmrg-13 "${testcvs} status" \ + 'cvs status: Examining .' + if [ -f "CVS/Tag" ] + then + fail "b2bmrg-14" # It's not supposed to be there. + fi + # add a file to the trunk. + echo fileabc > fileabc + ${testcvs} add fileabc >>$LFILE 2>&1 + ${testcvs} commit -m 'fileabc' >>$LFILE 2>&1 + cd ../../../trunk/first-dir + dotest b2bmrg-16 "${testcvs} update -d dirz" \ + 'cvs update: Updating dirz + U dirz/fileabc' + cd dirz + dotest b2bmrg-17 "${testcvs} status" \ + 'cvs status: Examining . + =================================================================== + File: fileabc Status: Up-to-date + + Working revision: 1.1 .* + Repository revision: 1.1 /tmp/cvs-sanity/cvsroot/first-dir/dirz/fileabc,v + Sticky Tag: (none) + Sticky Date: (none) + Sticky Options: (none)' + + + if [ -f "CVS/status" ] + then + fail "b2bmrg-15" # It's not supposed to be there. + fi + + /bin/rm -f $LFILE + cd ../../.. + /bin/rm -fr trunk b1b b1a b1 b2 + + } + # start keeping history touch ${CVSROOT_DIRNAME}/CVSROOT/history *************** *** 4746,4751 **** --- 4992,5004 ---- rm -rf first-dir ${CVSROOT_DIRNAME}/first-dir ;; + b2bmrg) + + # Tests a patch to fix problem wherein a branch-to-branch + # merge would leave new directories with no tags. + + test_branch_to_branch_merge + ;; *) echo $what is not the name of a test -- ignored ;;