CVS is a version control system (with some additional configuration management functionality). It maintains a central repository which stores files (often source code), including past versions, information about who modified them and when, and so on. People who wish to look at or modify those files, known as developers, use CVS to check out a working directory from the repository, to check in new versions of files to the repository, and other operations such as viewing the modification history of a file. If developers are connected to the repository by a network, particularly a slow or flaky one, the most efficient way to use the network is with the CVS-specific protocol described in this document.
Developers, using the machine on which they store their working directory, run the CVS client program. To perform operations which cannot be done locally, it connects to the CVS server program, which maintains the repository. For more information on how to connect see section How to Connect to and Authenticate Oneself to the CVS server.
This document describes the CVS protocol. Unfortunately, it does not yet completely document one aspect of the protocol--the detailed operation of each CVS command and option--and one must look at the CVS user documentation, `cvs.texinfo', for that information. The protocol is non-proprietary (anyone who wants to is encouraged to implement it) and an implementation, known as CVS, is available under the GNU Public License. The CVS distribution, containing this implementation, `cvs.texinfo', and a copy (possibly more or less up to date than what you are reading now) of this document, `cvsclient.texi', can be found at the usual GNU FTP sites, with a filename such as `cvs-version.tar.gz'.
This is version 1.9 of the protocol specification. This
version number is intended only to aid in distinguishing different
versions of this specification. Although the specification is currently
maintained in conjunction with the CVS implementation, and carries the
same version number, it also intends to document what is involved with
interoperating with other implementations (such as other versions of
CVS); see See section Required versus optional parts of the protocol. This version number should not be used
by clients or servers to determine what variant of the protocol to
speak; they should instead use the valid-requests
and
Valid-responses
mechanism (see section The CVS client/server protocol), which is more
flexible.
The client is built in to the normal cvs
program, triggered by a
specially-formatted CVSROOT
variable, for example
:server:cygnus.com:/rel/cvsfiles
.
The client stores what is stored in checked-out directories (including `CVS'). The way these are stored is totally compatible with standard CVS. The server requires no storage other than the repository, which also is totally compatible with standard CVS.
The current server implementation can use up huge amounts of memory
when transmitting a lot of data over a slow link (i.e. the network is
slower than the server can generate the data). There is some
experimental code (see SERVER_FLOWCONTROL
in options.h) which
should help significantly.
A number of enhancements are possible:
Modified
request could be speeded up by sending diffs rather
than entire files. The client would need some way to keep the version
of the file which was originally checked out; probably requiring the use
of "cvs edit" in this case is the most sensible course (the "cvs edit"
could be handled by a package like VC for emacs). This would also allow
local operation of cvs diff
without arguments.
cvs diff
and large parts of cvs update
and
cvs ci
to be local. The local copy could be made consistent with
the master copy at night (but if the master copy has been updated since
the latest nightly re-sync, then it would read what it needs to from the
master).
cvs update
is highly sub-optimal if
there are many modified files. One possible alternative would be to
have the client send a first request without the contents of every
modified file, then have the server tell it what files it needs. Note
the server needs to do the what-needs-to-be-updated check twice (or
more, if changes in the repository mean it has to ask the client for
more files), because it can't keep locks open while waiting for the
network. Perhaps this whole thing is irrelevant if client-side
repositories are implemented, and the rcsmerge is done by the client.
Connection and authentication occurs before the CVS protocol itself is started. There are several ways to connect.
cvs
. It is
invoked with one argument, server
. Once it invokes the server,
the client proceeds to start the cvs protocol.
In the following, `\n' refers to a linefeed and `\t' refers to a horizontal tab.
Entries lines are transmitted as:
/ name / version / conflict / options / tag_or_date
tag_or_date is either `T' tag or `D' date or empty. If it is followed by a slash, anything after the slash shall be silently ignored.
version can be empty, or start with `0' or `-', for no user file, new user file, or user file to be removed, respectively.
conflict, if it starts with `+', indicates that the file had conflicts in it. The rest of conflict is `=' if the timestamp matches the file, or anything else if it doesn't. If conflict does not start with a `+', it is silently ignored.
A mode is any number of repetitions of
mode-type = data
separated by `,'.
mode-type is an identifier composed of alphanumeric characters. Currently specified: `u' for user, `g' for group, `o' for other (see below for discussion of whether these have their POSIX meaning or are more loose). Unrecognized values of mode-type are silently ignored.
data consists of any data not containing `,', `\0' or `\n'. For `u', `g', and `o' mode types, data consists of alphanumeric characters, where `r' means read, `w' means write, `x' means execute, and unrecognized letters are silently ignored.
The two most obvious ways in which the mode matters are: (1) is it writeable? This is used by the developer communication features, and is implemented even on OS/2 (and could be implemented on DOS), whose notion of mode is limited to a readonly bit. (2) is it executable? Unix CVS users need CVS to store this setting (for shell scripts and the like). The current CVS implementation on unix does a little bit more than just maintain these two settings, but it doesn't really have a nice general facility to store or version control the mode, even on unix, much less across operating systems with diverse protection features. So all the ins and outs of what the mode means across operating systems haven't really been worked out (e.g. should the VMS port use ACLs to get POSIX semantics for groups?).
In most contexts, `/' is used to separate directory and file names in filenames, and any use of other conventions (for example, that the user might type on the command line) is converted to that form. The only exceptions might be a few cases in which the server provides a magic cookie which the client then repeats verbatim, but as the server has not yet been ported beyond unix, the two rules provide the same answer (and what to do if future server ports are operating on a repository like e:/foo or CVS_ROOT:[FOO.BAR] has not been carefully thought out).
By convention, requests which begin with a capital letter do not elicit a response from the server, while all others do -- save one. The exception is `gzip-file-contents'. Unrecognized requests will always elicit a response from the server, even if that request begins with a capital letter.
File contents (noted below as file transmission) can be sent in one of two forms. The simpler form is a number of bytes, followed by a newline, followed by the specified number of bytes of file contents. These are the entire contents of the specified file. Second, if both client and server support `gzip-file-contents', a `z' may precede the length, and the `file contents' sent are actually compressed with `gzip' (RFC1952/1951) compression. The length specified is that of the compressed version of the file.
In neither case are the file content followed by any additional data. The transmission of a file will end with a newline iff that file (or its compressed form) ends with a newline.
Root pathname \n
CVSROOT
to use.
Note that pathname is a local directory and not a fully
qualified CVSROOT
variable. pathname must
already exist; if creating a new root, use the init
request, not
Root
. pathname does not include the hostname of the
server, how to access the server, etc.; by the time the CVS protocol is
in use, connection, authentication, etc., are already taken care of.
Valid-responses request-list \n
valid-requests \n
Valid-requests
response.
Repository repository \n
Entry
and Modified
and
also for ci
and the other commands; normal usage is to send a
Repository
for each directory in which there will be an
Entry
or Modified
, and then a final Repository
for the original directory, then the command.
Directory local-directory \n
Repository
,
but the local name of the directory may differ from the repository name.
If the client uses this request, it affects the way the server returns
pathnames; see section Responses. local-directory is relative to
the top level at which the command is occurring (i.e. the last
Directory
or Repository
which is sent before the command);
to indicate that top level, `.' should be send for
local-directory.
Max-dotdot level \n
Directory
requests are relative to will be
needed. For example, if the client is planning to use a
Directory
request for `../../foo', it must send a
Max-dotdot
request with a level of at least 2.
Max-dotdot
must be sent before the first Directory
request.
Static-directory \n
Repository
or Directory
should not have
additional files checked out unless explicitly requested. The client
sends this if the Entries.Static
flag is set, which is controlled
by the Set-static-directory
and Clear-static-directory
responses.
Sticky tagspec \n
Repository
has a sticky tag or date tagspec.
The first character of tagspec is `T' for a tag, or `D'
for a date. The remainder of tagspec contains the actual tag or
date.
Checkin-prog program \n
Directory
has a checkin program program.
Such a program would have been previously set with the
Set-checkin-prog
response.
Update-prog program \n
Directory
has an update program program.
Such a program would have been previously set with the
Set-update-prog
response.
Entry entry-line \n
Repository
. If the user
is operating on only some files in a directory, Entry
requests
for only those files need be included. If an Entry
request is
sent without Modified
, Unchanged
, or Lost
for that
file the meaning depends on whether UseUnchanged
has been sent;
if it has been it means the file is lost, if not it means the file is
unchanged.
Modified filename \n
Repository
. If
the user is operating on only some files in a directory, only those
files need to be included. This can also be sent without Entry
,
if there is no entry for the file.
Lost filename \n
Repository
. This is used for any case in which Entry
is
being sent but the file no longer exists. If the client has issued the
UseUnchanged
request, then this request is not used.
Unchanged filename \n
Repository
. This request can only be
issued if UseUnchanged
has been sent.
UseUnchanged \n
Unchanged
, and that files for
which no information is sent are nonexistent on the client side, not
unchanged. This is necessary for correct behavior since only the server
knows what possible files may exist, and thus what files are
nonexistent.
Notify filename \n
edit
or unedit
command has taken
place. The server needs to send a Notified
response, but such
response is deferred until the next time that the server is sending
responses. Response expected: no. Additional data:
notification-type \t time \t clienthost \t working-dir \t watches \nwhere notification-type is `E' for edit or `U' for unedit, time is the time at which the edit or unedit took place, clienthost is the name of the host on which the edit or unedit took place, and working-dir is the pathname of the working directory where the edit or unedit took place. watches are the temporary watches to set; if it is followed by \t then the tab and the rest of the line are ignored.
Questionable filename \n
M
response) `?' followed
by the directory and filename. filename must not contain
`/'; it needs to be a file in the directory named by the most
recent Directory
request.
Case \n
Entry
and
Modified
requests for the same file must match in case regardless
of whether the Case
request is sent.
Argument text \n
Argumentx text \n
Global_option option \n
valid-requests
, it is probably better to
make new global options separate requests, rather than trying to add
them to this request.
Gzip-stream level \n
Kerberos-encrypt \n
Gzip-stream
and
the Kerberos-encrypt
requests are used, the
Kerberos-encrypt
request should be used first. This will make
the client and server encrypt the compressed data, as opposed to
compressing the encrypted data. Encrypted data is generally
incompressible.
Set variable=value \n
expand-modules \n
Module-expansion
responses. Note
that the server can assume that this is checkout or export, not rtag or
rdiff; the latter do not access the working directory and thus have no
need to expand modules on the client side.
co \n
ci \n
diff \n
tag \n
status \n
log \n
add \n
remove \n
rdiff \n
rtag \n
admin \n
export \n
history \n
watchers \n
editors \n
annotate \n
Argument
, Repository
, Entry
,
Modified
, or Lost
requests, if they have been sent. The
last Repository
sent specifies the working directory at the time
of the operation. No provision is made for any input from the user.
This means that ci
must use a -m
argument if it wants to
specify a log message.
init root-name \n
CVSROOT
variable. The
Root
request need not have been previously sent.
update \n
cvs update
command. This
uses any previous Argument
, Repository
, Entry
,
Modified
, or Lost
requests, if they have been sent. The
last Repository
sent specifies the working directory at the time
of the operation. The -I
option is not used--files which the
client can decide whether to ignore are not mentioned and the client
sends the Questionable
request for others.
import \n
cvs import
command. This
uses any previous Argument
, Repository
, Entry
,
Modified
, or Lost
requests, if they have been sent. The
last Repository
sent specifies the working directory at the time
of the operation. The files to be imported are sent in Modified
requests (files which the client knows should be ignored are not sent;
the server must still process the CVSROOT/cvsignore file unless -I ! is
sent). A log message must have been specified with a -m
argument.
watch-on \n
watch-off \n
watch-add \n
watch-remove \n
cvs watch on
, cvs
watch off
, cvs watch add
, and cvs watch remove
commands,
respectively. This uses any previous Argument
,
Repository
, Entry
, Modified
, or Lost
requests, if they have been sent. The last Repository
sent
specifies the working directory at the time of the operation.
release \n
cvs release
command has
taken place and update the history file accordingly.
noop \n
Notified
responses, etc.
update-patches \n
update
request. The client must issue the -u
argument to update
in order to receive patches.
gzip-file-contents level \n
Gzip-stream
is suggested
instead of gzip-file-contents
as it gives better compression; the
only reason to implement the latter is to provide compression with
CVS 1.8 and earlier. The gzip-file-contents
request asks
the server to compress files it sends to the client using gzip
(RFC1952/1951) compression, using the specified level of compression.
If this request is not made, the server must not compress files.
This is only a hint to the server. It may still decide (for example, in the case of very small files, or files that already appear to be compressed) not to do the compression. Compression is indicated by a `z' preceding the file length.
Availability of this request in the server indicates to the client that it may compress files sent to the server, regardless of whether the client actually uses this request.
other-request text \n
When the client is done, it drops the connection.
After a command which expects a response, the server sends however many of the following responses are appropriate. The server should not send data at other times (the current implementation may violate this principle in a few minor places, where the server is printing an error message and exiting--this should be investigated further).
Pathnames are of the actual files operated on (i.e. they do not contain
`,v' endings), and are suitable for use in a subsequent
Repository
request. However, if the client has used the
Directory
request, then it is instead a local directory name
relative to the directory in which the command was given (i.e. the last
Directory
before the command). Then a newline and a repository
name (the pathname which is sent if Directory
is not used). Then
the slash and the filename. For example, for a file `i386.mh'
which is in the local directory `gas.clean/config' and for which
the repository is `/rel/cvsfiles/devo/gas/config':
gas.clean/config/ /rel/cvsfiles/devo/gas/config/i386.mh
Any response always ends with `error' or `ok'. This indicates that the response is over.
Valid-requests request-list \n
Checked-in pathname \n
New-entry pathname \n
Checked-in
, but the
file is not up to date.
Updated pathname \n
Created
and
Update-existing
are supported.
Created pathname \n
Updated
and takes the same additional data, but
is used only if no Entry
, Modified
, or
Unchanged
request has been sent for the file in question. The
distinction between Created
and Update-existing
is so
that the client can give an error message in several cases: (1) there is
a file in the working directory, but not one for which Entry
,
Modified
, or Unchanged
was sent (for example, a file which
was ignored, or a file for which Questionable
was sent), (2)
there is a file in the working directory whose name differs from the one
mentioned in Created
in ways that the client is unable to use to
distinguish files. For example, the client is case-insensitive and the
names differ only in case.
Update-existing pathname \n
Updated
and takes the same additional data, but
is used only if a Entry
, Modified
, or Unchanged
request has been sent for the file in question.
Merged pathname \n
Updated
and takes the same additional data,
with the one difference that after the new copy of the file is enclosed,
it will still not be up to date. Used for the results of a merge, with
or without conflicts.
Patched pathname \n
Updated
and takes the same additional data,
with the one difference that instead of sending a new copy of the file,
the server sends a patch. This patch is produced by `diff -c' for
CVS 1.6 and later (see POSIX.2 for a description of this format),
or `diff -u' for previous versions of CVS; clients are
encouraged to accept either format. The client must apply this patch to
the existing file. This will only be used when the client has an exact
copy of an earlier revision of a file. This response is only used if
the update
command is given the `-u' argument.
Mode mode \n
Checked-in
. It does not apply to any request which follows a
Checked-in
, New-entry
, Updated
, Merged
, or
Patched
response.
Checksum checksum\n
Updated
, Merged
, or Patched
. In the case of
Patched
, the checksum applies to the file after being patched,
not to the patch itself. The client should compute the checksum itself,
after receiving the file or patch, and signal an error if the checksums
do not match. The checksum is the 128 bit MD5 checksum represented as
32 hex digits. This response is optional, and is only used if the
client supports it (as judged by the Valid-responses
request).
Copy-file pathname \n
CVS/Entries
.
Removed pathname \n
Remove-entry pathname \n
CVS/Entries
, but the file
itself is already gone (this happens in response to a ci
request
which involves committing the removal of a file).
Set-static-directory pathname \n
Entries.Static
flag, which
it should then send back to the server in a Static-directory
request whenever the directory is operated on. pathname ends in a
slash; its purpose is to specify a directory, not a file within a
directory.
Clear-static-directory pathname \n
Set-static-directory
, but clear, not set, the flag.
Set-sticky pathname \n
Sticky
request for
future operations. pathname ends in a slash; its purpose is to
specify a directory, not a file within a directory. The first character
of tagspec is `T' for a tag, or `D' for a date. The
remainder of tagspec contains the actual tag or date.
Clear-sticky pathname \n
Set-sticky
.
Template pathname \n
Set-checkin-prog dir \n
Checkin-prog
request
for future operations.
Set-update-prog dir \n
Update-prog
request
for future operations.
Notified pathname \n
Notify
request; if there are several Notify
requests for a single file,
the requests should be processed in order; the first Notified
response pertains to the first Notify
request, etc.
Module-expansion pathname \n Return a file or directory
co
request (for example, if the modules file
contains the `-d' option, it will be the directory specified with
`-d', not the name of the module).
M text \n
E text \n
M
but send to stderr not stdout.
F \n
error errno-code ` ' text \n
ENOENT
); if the server doesn't support this
feature, or if it's not appropriate for this particular message, it just
omits the errno-code (in that case there are two spaces after
`error'). Text is an error message such as that provided by
strerror(), or any other message the server wants to use.
ok \n
Lines beginning with `c>' are sent by the client; lines beginning with `s>' are sent by the server; lines beginning with `#' are not part of the actual exchange.
c> Root /rel/cvsfiles # In actual practice the lists of valid responses and requests would # be longer c> Valid-responses Updated Checked-in M ok error c> valid-requests s> Valid-requests Root co Modified Entry Repository ci Argument Argumentx s> ok # cvs co devo/foo c> Argument devo/foo c> co s> Updated /rel/cvsfiles/devo/foo/foo.c s> /foo.c/1.4/Mon Apr 19 15:36:47 1993 Mon Apr 19 15:36:47 1993// s> 26 s> int mein () { abort (); } s> Updated /rel/cvsfiles/devo/foo/Makefile s> /Makefile/1.2/Mon Apr 19 15:36:47 1993 Mon Apr 19 15:36:47 1993// s> 28 s> foo: foo.c s> $(CC) -o foo $< s> ok # The current implementation would break the connection here and make a # new connection for the next command. However, the protocol allows it # to keep the connection open and continue, which is what we show here. c> Repository /rel/cvsfiles/devo/foo # foo.c relative to devo/foo just set as Repository. c> Entry /foo.c/1.4/Mon Apr 19 15:36:47 1993 Mon Apr 19 15:36:47 1993// c> Entry /Makefile/1.2/Mon Apr 19 15:36:47 1993 Mon Apr 19 15:36:47 1993// c> Modified foo.c c> 26 c> int main () { abort (); } # cvs ci -m <log message> foo.c c> Argument -m c> Argument Well, you see, it took me hours and hours to find this typo and I c> Argumentx searched and searched and eventually had to ask John for help. c> Argument foo.c c> ci s> Checked-in /rel/cvsfiles/devo/foo/foo.c s> /foo.c/1.5/ Mon Apr 19 15:54:22 CDT 1993// s> M Checking in foo.c; s> M /cygint/rel/cvsfiles/devo/foo/foo.c,v <-- foo.c s> M new revision: 1.5; previous revision: 1.4 s> M done s> ok
The following are part of every known implementation of the CVS protocol and it is considered reasonable behavior to completely fail to work if you are connected with an implementation which attempts to not support them. Requests: Root, Valid-responses, valid-requests, Repository, Entry, Modified, Argument, Argumentx, ci, co, update. Responses: ok, error, Valid-requests, Checked-in, Updated, Merged, Removed, M, E.
Failure to support the Directory, UseUnchanged, and Unchanged requests is deprecated. CVS 1.5 and later have supported these requests and in the future it will be considered reasonable behavior to completely fail to work with an implementation which attempts to not support them. Support for the Repository and Lost requests is deprecated; CVS clients 1.5 and later will not use them if communicating with a server which supports Directory and UseUnchanged.