|Version Management with CVS - the CVS manual|
by Per Cederqvist et al.
Paperback (6"x9"), 216 pages, 8 figures
RRP £19.95 ($29.95)
5.10 Merging and keywords
If you merge files containing keywords (see section 12 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’ (see section 12.4 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: 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 220.127.116.11 Merging differences between 1.1 and 18.104.22.168 into file1 rcsmerge: warning: conflicts during merge $ cat file1 <<<<<<< file1 key $Revision: 1.2 $ ======= key $Revision: 22.214.171.124 $ >>>>>>> 126.96.36.199 . . .
What happened was that the merge tried to merge the
differences between 1.1 and 188.8.131.52 into your working
directory. So, since the keyword changed from
Revision: 1.1 to
CVS tried to merge that change into your working
directory, which conflicted with the fact that your
working directory had contained
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 184.108.40.206 Merging differences between 1.1 and 220.127.116.11 into file1 $ cat file1 key $Revision$ . . .
What is going on here is that revision 1.1 and 18.104.22.168
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.
There is, however, one major caveat with using ‘-kk’ on merges. Namely, it overrides whatever keyword expansion mode CVS would normally have used. In particular, this is a problem if the mode had been ‘-kb’ for a binary file. Therefore, if your repository contains binary files, you will need to deal with the conflicts rather than using ‘-kk’.
As a result of using ‘-kk’ during the merge, each file examined by the
update will have ‘-kk’ set as sticky options. Running
will clear the sticky options on unmodified files, but it will not clear
the sticky options on modified files. To get back to the default keyword
substitution for modified files, you must commit the results of the merge
and then run
|ISBN 0954161718||Version Management with CVS - the CVS manual||See the print edition|