(cvs.info.gz) Merging and keywords
Info Catalog
(cvs.info.gz) Merging adds and removals
(cvs.info.gz) Branching and merging
5.10 Merging and keywords
=========================
If you merge files containing keywords ( Keyword substitution),
you will normally get numerous conflicts during the merge, because the
keywords are expanded differently in the revisions which you are
merging.
Therefore, you will often want to specify the `-kk' (
Substitution modes) switch to the merge command line. By
substituting just the name of the keyword, not the expanded value of
that keyword, this option ensures that the revisions which you are
merging will be the same as each other, and avoid spurious conflicts.
For example, suppose you have a file like this:
+---------+
_! 1.1.2.1 ! <- br1
/ +---------+
/
/
+-----+ +-----+
! 1.1 !----! 1.2 !
+-----+ +-----+
and your working directory is currently on the trunk (revision 1.2).
Then you might get the following results from a merge:
$ cat file1
key $Revision: 1.2 $
. . .
$ cvs update -j br1
U file1
RCS file: /cvsroot/first-dir/file1,v
retrieving revision 1.1
retrieving revision 1.1.2.1
Merging differences between 1.1 and 1.1.2.1 into file1
rcsmerge: warning: conflicts during merge
$ cat file1
<<<<<<< file1
key $Revision: 1.2 $
=======
key $Revision: 1.1.2.1 $
>>>>>>> 1.1.2.1
. . .
What happened was that the merge tried to merge the differences
between 1.1 and 1.1.2.1 into your working directory. So, since the
keyword changed from `Revision: 1.1' to `Revision: 1.1.2.1', CVS tried
to merge that change into your working directory, which conflicted with
the fact that your working directory had contained `Revision: 1.2'.
Here is what happens if you had used `-kk':
$ cat file1
key $Revision: 1.2 $
. . .
$ cvs update -kk -j br1
U file1
RCS file: /cvsroot/first-dir/file1,v
retrieving revision 1.1
retrieving revision 1.1.2.1
Merging differences between 1.1 and 1.1.2.1 into file1
$ cat file1
key $Revision$
. . .
What is going on here is that revision 1.1 and 1.1.2.1 both expand
as plain `Revision', and therefore merging the changes between them
into the working directory need not change anything. Therefore, there
is no conflict.
*WARNING: In versions of CVS prior to 1.12.2, there was a major
problem with using `-kk' on merges. Namely, `-kk' overrode any default
keyword expansion mode set in the archive file in the repository. This
could, unfortunately for some users, cause data corruption in binary
files (with a default keyword expansion mode set to `-kb'). Therefore,
when a repository contained binary files, conflicts had to be dealt
with manually rather than using `-kk' in a merge command.*
In CVS version 1.12.2 and later, the keyword expansion mode provided
on the command line to any CVS command no longer overrides the `-kb'
keyword expansion mode setting for binary files, though it will still
override other default keyword expansion modes. You can now safely
merge using `-kk' to avoid spurious conflicts on lines containing RCS
keywords, even when your repository contains binary files.
Info Catalog
(cvs.info.gz) Merging adds and removals
(cvs.info.gz) Branching and merging
automatically generated byinfo2html