Substitution modes

Keyword substitution modes are stored for each version of a file. When you commit a new revision that version will be stored exactly as it is in the sandbox, including the substitution mode.

You can override the substitution mode by using the -k option to cvs add, -k or -A options to cvs checkout or cvs update. cvs diff also has a -k option. For some examples, see Chapter 10, Handling binary files, and the section called “Merging and keywords”.

The cvs update and cvs checkout commands allow you to modify existing substitution modes without overwriting the existing ones. This is done by prefixing the mode with '+' (for add) or '-' (for remove). For example to switch off keyword substitution for all files in a subtree:

$ cvs update -k+o
$ cvs commit -fm "Change substitution mode"

The modes available are defined by combining an optional encoding with a series of options.

Some combinations were not available on older CVS versions so be careful if you want to access your repository from older clients. The CVSNT server will automatically downgrade some of these options if an older client fetches a file.

Encodings:

t

Treat the file as a text file. This is the default setting if no encoding is specified.

MBCS character sets that don't change the behaviour of CR/LF and NULL should also work in this mode. eg. Shift-JIS and EUC.

b

Treat the file as binary. No interpretation is done of the contents and they are stored verbatim. Be default no keyword expansion is done. Binary files are considered non-mergable by CVS.

B

Treat the file as binary. No interpretation is done of the contents and they are stored verbatim. Be default no keyword expansion is done. Binary files are considered non-mergable by CVS. In addition, an alternate storage algorithm is used that is optimised for storage of binary files.

u

Treat the file as Unicode. The file will be checked in/out in UCS-2 (or UTF-16) encoding and internally stored as UTF-8 by the server.

{...}

Use an extended encoding. Any encoding supported by the client-side iconv library can be used, however beware of mismatches between clients (the Win32 version does not currently support EBCIDIC encodings for example). The following list will work on all platforms that are using Unicode-capable CVSNT:

ucs2le, utf16le

Little-endian UCS-2 without BOM.

ucs2be, utf16be

Big-endian UCS-2 without BOM.

ucs2le_bom, utf16le_bom

Little-endian UCS-2 with BOM.

ucs2be_bom, utf16be_bom

Big-endian UCS-2 with BOM.

Flags:

c

Enforce cooperative edits (edit -c) for the file.

x

Enforce reserved (ie: exclusive) edit (edit -x) for the file.

k

Preserve the keyword string (default). When combined with the v flag this generates results using the default form, e.g. $Revision$ for the Revision keyword. On its own it produces output with no keywords expanded.

v

Generate keyword values for keyword strings. Normally paired with the k option. If it is used on its own the effect is to strip keywords from the output - for example, for the Revision keyword, generate the string 5.7 instead of $Revision: 1.1.2.1$. This can help generate files in programming languages where it is hard to strip keyword delimiters like $Revision$ from a string. However, further keyword substitution cannot be performed once the keyword names are removed, so this option should be used with care.

l

Insert the lockers name if the given revision is currently locked. The locker's name is only relevant if cvs admin -l is in use.

s

File is never considered modified on the client. A normal commit will never commit this file, unless -f is used to force it. Use with care, and for files that change infrequently, since local changes will be lost on update.

1

Unversioned. Only ever keep a single revision in the repository. History is lost, and the file is merely kept as the latest copy. Only one branch (HEAD) ever exists and an update of any revision will return the single revision.

L

When checking out, always create a file with Unix line endings (LF).

D

Whcn checking out, always create a file with Dos/Windows line endings (CR/LF).

M

When checking out, always create a file with Mac line endings (CR)

o

Generate the old keyword string, present in the working file just before it was checked in. For example, for the Revision keyword, generate the string $Revision: 1.1.2.1;$ instead of $Revision$ if that is how the string appeared when the file was checked in.

z

Compress the files and deltas when they are stored. This sacrifices speed for disk space - only use if disk space is at a premium.