info-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Merge Confusion


From: Jim.Hyslop
Subject: RE: Merge Confusion
Date: Wed, 30 Jun 2004 10:37:49 -0400

work wrote:
[snip details]
> while in local sandbox, issued cvs tag rel_1-before-branch
> then issued cvs tag -r rel_1-before-branch -b rel_1
> then issued cvs tag rel_2_start 
[...]
> I go into the rel_1/testproj sandbox and issue the following 
> commands: 
> 
> make sure i have the latest sources - cvs -q up -dP
Excellent - people sometimes forget this important step

> tag the repository - cvs tag rel_1-20040630 

> I go into the rel_2/testproj sandbox and issue the following 
> commands: 

> tag the repository - cvs tag rel_2-20040630 
> 
> Now I'm ready to merge.  Since I want to merge from the 
> branch into the 
> trunk, I'll be in the rel_2/testproj sandbox.  Which command 
> do I issue? 
Remember that, unless you are doing something extremely unusual, both tags
in the update command should be on the same branch. This eliminates any of
your options involving tags on the trunk, leaving only:

> 3 - cvs up -j rel_1 -j rel_1-20040630 
> 5 - cvs up -j rel_1-20040630 -j rel_1 
> 7 - cvs up -j rel_1-20040630 

'cvs update -jX -jY' says "take the delta from X to Y and apply it to the
current directory". 

Now, because you applied the tag rel_1-20040630 to the tip of rel_1 branch,
that means rel_1 and rel_1-20040630 refer to the same revision (unless
somebody checks something into the branch while you're doing this, but we'll
leave that aside for now). This means that 3 and 5 are no-ops: there is no
difference to apply.

This leaves option 7. In this particular case, it will work. With only one
-j option specified, CVS will automatically determine the correct base point
to use. CVS will act as if you had issued the command:

cvs up -r rel_1-before-branch -j rel_1-20040630

As I said, *in this case* it will work. In subesequent merges, it will not
work: you must explicitly specify the starting point, otherwise CVS will
again use the common ancestor as the starting revision, and you'll get the
same changes merged twice. Thats why I prefer to always use both -j options
when merging.

> At this point, I'm not overly 
> concerned about 
> deleted or added files (to me they are much easier to deal 
> with since the 
> entire file is involved). 
You will have to use 'cvs add' and 'cvs remove' to have these files added or
removed from the trunk.

> This looks something like a quiz, but I'm not the teacher, I'm just a 
> horribly confused student and really don't want to screw up 
> 10,000+ files 
> that are under cvs control.
For these situations, you can always set up a test portion of the
repository. Create a directory, say $CVSROOT/cvs-test, and try it out there.
The understanding is that anything in cvs-test can be deleted without
warning, and nothing of value should go in there.

Also, remember that even if you mess up on some of the commands, nothing
gets committed until you issue the "cvs commit" command. So, if worse comes
to worst and you've really mucked it up, just blow away your working copy,
check out a fresh copy and try again.

Happy merging ;)

-- 
Jim Hyslop
Senior Software Designer
Leitch Technology International Inc. (http://www.leitch.com)
Columnist, C/C++ Users Journal (http://www.cuj.com/experts)





reply via email to

[Prev in Thread] Current Thread [Next in Thread]