]> CVS Client/Server This document describes the client/server protocol used by CVS. It does not describe how to use or administer client/server CVS; see the regular CVS manual for that. This is version 1.11.22 of the protocol specification—See , for more on what this version number means. Introduction 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 . 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.11.22 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 . 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 ), which is more flexible. Goals Do not assume any access to the repository other than via this protocol.It does not depend on NFS, rdist, etc. Providing a reliable transport is outside this protocol. The protocolexpects a reliable transport that is transparent (that is, there is notranslation of characters, including characters such aslinefeeds or carriage returns), and can transmit all 256 octets (forexample for proper handling of binary files, compression, andencryption). The encoding of characters specified by the protocol (thenames of requests and so on) is the invariant ISO 646 character set (asubset of most popular character sets including ASCII and others). Formore details on running the protocol over the TCP reliable transport,see . Security and authentication are handled outside this protocol (but seebelow about ‘cvs kserver’ and ‘cvs pserver’). The protocol makes it possible for updates to be atomic with respect tocheckins; that is if someone commits changes to several files in one cvscommand, then an update by someone else would either get all thechanges, or none of them. The current cvs server can't do this,but that isn't the protocol's fault. The protocol is, with a few exceptions, transaction-based. That is, theclient sends all its requests (without waiting for server responses),and then waits for the server to send back all responses (withoutwaiting for further client requests). This has the advantage ofminimizing network turnarounds and the disadvantage of sometimestransferring more data than would be necessary if there were a richerinteraction. Another, more subtle, advantage is that there is no needfor the protocol to provide locking for features such as making checkinsatomic with respect to updates. Any such locking can be handledentirely by the server. A good server implementation (such as thecurrent cvs server) will make sure that it does not have any suchlocks in place whenever it is waiting for communication with the client;this prevents one client on a slow or flaky network from interferingwith the work of others. It is a general design goal to provide only one way to do a givenoperation (where possible). For example, implementations have no choiceabout whether to terminate lines with linefeeds or some othercharacter(s), and request and response names are case-sensitive. Thisis to enhance interoperability. If a protocol allows more than one wayto do something, it is all too easy for some implementations to supportonly some of them (perhaps accidentally). How to Connect to and Authenticate Oneself to the CVS server Connection and authentication occurs before the CVS protocol itself is started. There are several ways to connect. server If the client has a way to execute commands on the server, and provideinput to the commands and output from them, then it can connect thatway. This could be the usual rsh (port 514) protocol, Kerberos rsh,SSH, or any similar mechanism. The client may allow the user to specifythe name of the server program; the default is cvs. It isinvoked with one argument, server. Once it invokes the server,the client proceeds to start the cvs protocol. kserver The kerberized server listens on a port (in the current implementation,by having inetd call "cvs kserver") which defaults to 1999. The clientconnects, sends the usual kerberos authentication information, and thenstarts the cvs protocol. Note: port 1999 is officially registered foranother use, and in any event one cannot register more than one port forCVS, so GSS-API (see below) is recommended instead of kserver as a wayto support kerberos. pserver The name pserver is somewhat confusing. It refers to both ageneric framework which allows the CVS protocol to support severalauthentication mechanisms, and a name for a specific mechanism whichtransfers a username and a cleartext password. Servers need not supportall mechanisms, and in fact servers will typically want to support onlythose mechanisms which meet the relevant security needs.The pserver server listens on a port (in the currentimplementation, by having inetd call "cvs pserver") which defaults to2401 (this port is officially registered). The clientconnects, and sends the following: the string ‘BEGIN AUTH REQUEST’, a linefeed, the cvs root, a linefeed, the username, a linefeed, the password trivially encoded (see ), alinefeed, the string ‘END AUTH REQUEST’, and a linefeed. The client must send theidentical string for cvs root both here and later in theRoot request of the cvsprotocol itself. Servers are encouraged to enforce this restriction.The possible server responses (each of which is followed by a linefeed)are the following. Note that although there is a small similaritybetween this authentication protocol and the cvs protocol, they areseparate. I LOVE YOU The authentication is successful. The client proceeds with the cvsprotocol itself. I HATE YOU The authentication fails. After sending this response, the server mayclose the connection. It is up to the server to decide whether to givethis response, which is generic, or a more specific response using‘E’ and/or ‘error’. E text Provide a message for the user. After this reponse, the authenticationprotocol continues with another response. Typically the server willprovide a series of ‘E’ responses followed by ‘error’.Compatibility note: cvs 1.9.10 and older clients will printunrecognized auth response and text, and then exit, uponreceiving this response. error code text The authentication fails. After sending this response, the server mayclose the connection. The code is a code describing why itfailed, intended for computer consumption. The only code currentlydefined is ‘0’ which is nonspecific, but clients must silentlytreat any unrecognized codes as nonspecific.The text should be supplied to theuser. Compatibility note: cvs 1.9.10 and older clients will printunrecognized auth response and text, and then exit, uponreceiving this response.Note that text for this response, or the text in an Eresponse, is not designed for machine parsing. More vigorous use ofcode, or future extensions, will be needed to prove a cleanermachine-parseable indication of what the error was. If the client wishes to merely authenticate without starting the cvsprotocol, the procedure is the same, except BEGIN AUTH REQUEST isreplaced with BEGIN VERIFICATION REQUEST, END AUTH REQUESTis replaced with END VERIFICATION REQUEST, and upon receipt ofI LOVE YOU the connection is closed rather than continuing.Another mechanism is GSSAPI authentication. GSSAPI is ageneric interface to security services such as kerberos. GSSAPI isspecified in RFC2078 (GSSAPI version 2) and RFC1508 (GSSAPI version 1);we are not aware of differences between the two which affect theprotocol in incompatible ways, so we make no attempt to specify oneversion or the other.The procedure here is to start with ‘BEGINGSSAPI REQUEST’. GSSAPI authentication information is then exchangedbetween the client and the server. Each packet of information consistsof a two byte big endian length, followed by that many bytes of data.After the GSSAPI authentication is complete, the server continues withthe responses described above (‘I LOVE YOU’, etc.). future possibilities There are a nearly unlimited number of ways to connect and authenticate.One might want to allow access based on IP address (similar to the usualrsh protocol but with different/no restrictions on ports < 1024), toadopt mechanisms such as Pluggable Authentication Modules (PAM), toallow users to run their own servers under their own usernames withoutroot access, or any number of other possibilities. The way to addfuture mechanisms, for the most part, should be to continue to use port2401, but to use different strings in place of ‘BEGIN AUTHREQUEST’. Password scrambling algorithm The pserver authentication protocol, as described in , trivially encodes the passwords. This is only to prevent inadvertent compromise; it provides no protection against even a relatively unsophisticated attacker. For comparison, HTTP Basic Authentication (as described in RFC2068) uses BASE64 for a similar purpose. CVS uses its own algorithm, described here. The scrambled password starts with ‘A’, which serves to identify the scrambling algorithm in use. After that follows a single octet for each character in the password, according to a fixed encoding. The values are shown here, with the encoded values in decimal. Control characters, space, and characters outside the invariant ISO 646 character set are not shown; such characters are not recommended for use in passwords. There is a long discussion of character set issues in . 0 111 P 125 p 58 ! 120 1 52 A 57 Q 55 a 121 q 113 " 53 2 75 B 83 R 54 b 117 r 32 3 119 C 43 S 66 c 104 s 90 4 49 D 46 T 124 d 101 t 44 % 109 5 34 E 102 U 126 e 100 u 98 & 72 6 82 F 40 V 59 f 69 v 60 ' 108 7 81 G 89 W 47 g 73 w 51 ( 70 8 95 H 38 X 92 h 99 x 33 ) 64 9 65 I 103 Y 71 i 63 y 97 * 76 : 112 J 45 Z 115 j 94 z 62 + 67 ; 86 K 50 k 93 , 116 < 118 L 42 l 39 - 74 = 110 M 123 m 37 . 68 > 122 N 91 n 61 / 87 ? 105 O 35 _ 56 o 48 The CVS client/server protocol In the following, ‘\n’ refers to a linefeed and ‘\t’ refers to a horizontal tab; requests are what the client sends and responses are what the server sends. In general, the connection is governed by the client—the server does not send responses without first receiving requests to do so; see for more details of this convention. It is typical, early in the connection, for the client to transmit a Valid-responses request, containing all the responses it supports, followed by a valid-requests request, which elicits from the server a Valid-requests response containing all the requests it understands. In this way, the client and server each find out what the other supports before exchanging large amounts of data (such as file contents). Entries Lines Entries lines are transmitted as: / name / version / conflict / options / tag_or_date tag_or_date is either ‘Ttag or ‘Ddate 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. options signifies the keyword expansion options (for example ‘-ko’). In an Entry request, this indicates the options that were specified with the file from the previous file updating response (see , for a list of file updating responses); if the client is specifying the ‘-k’ or ‘-A’ option to update, then it is the server which figures out what overrides what. File Modes 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?). Conventions regarding transmission of file names 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). Characters outside the invariant ISO 646 character set should be avoided in filenames. This restriction may need to be relaxed to allow for characters such as ‘[’ and ‘]’ (see above about non-unix servers); this has not been carefully considered (and currently implementations probably use whatever character sets that the operating systems they are running on allow, and/or that users specify). Of course the most portable practice is to restrict oneself further, to the POSIX portable filename character set as specified in POSIX.1. File transmissions 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 linefeed, 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 linefeed iff that file (or its compressed form) ends with a linefeed. The encoding of file contents depends on the value for the ‘-k’ option. If the file is binary (as specified by the ‘-kb’ option in the appropriate place), then it is just a certain number of octets, and the protocol contributes nothing towards determining the encoding (using the file name is one widespread, if not universally popular, mechanism). If the file is text (not binary), then the file is sent as a series of lines, separated by linefeeds. If the keyword expansion is set to something other than ‘-ko’, then it is expected that the file conform to the RCS expectations regarding keyword expansion—in particular, that it is in a character set such as ASCII in which 0x24 is a dollar sign (‘$’). Strings In various contexts, for example the Argument request and the M response, one transmits what is essentially an arbitrary string. Often this will have been supplied by the user (for example, the ‘-m’ option to the ci request). The protocol has no mechanism to specify the character set of such strings; it would be fairly safe to stick to the invariant ISO 646 character set but the existing practice is probably to just transmit whatever the user specifies, and hope that everyone involved agrees which character set is in use, or sticks to a common subset. Dates The protocol contains times and dates in various places. For the ‘-D’ option to the annotate, co, diff, export, history, rannotate, rdiff, rtag, tag, and update requests, the server should support two formats: 26 May 1997 13:01:40 -0000 ; RFC 822 as modified by RFC 1123 5/26/1997 13:01:40 GMT ; traditional The former format is preferred; the latter however is sent by the CVS command line client (versions 1.5 through at least 1.9). For the ‘-d’ option to the log and rlog requests, servers should at least support RFC 822/1123 format. Clients are encouraged to use this format too (the command line CVS client, version 1.10 and older, just passed along the date format specified by the user, however). The Mod-time response and Checkin-time request use RFC 822/1123 format (see the descriptions of that response and request for details). For Notify, see the description of that request. Request intro 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. The term command means a request which expects a response (except valid-requests). The general model is that the client transmits a great number of requests, but nothing happens until the very end when the client transmits a command. Although the intention is that transmitting several commands in one connection should be legal, existing servers probably have some bugs with some combinations of more than one command, and so clients may find it necessary to make several connections in some cases. This should be thought of as a workaround rather than a desired attribute of the protocol. Requests Here are the requests: Root pathname \n Response expected: no. Tell the server which CVSROOT to use.Note that pathname is not a fully qualified CVSROOTvariable, but only the local directory part of it. pathname mustalready exist on the server; if creating a new root, use the initrequest, not Root. Again, pathname does not includethe hostname of the server, how to access the server, etc.; by the timethe CVS protocol is in use, connection, authentication, etc., arealready taken care of.The Root request must be sent only once, and it must be sentbefore any requests other than Valid-responses,valid-requests, UseUnchanged, Set,Global_option, init, noop, or version. Valid-responses request-list \n Response expected: no.Tell the server what responses the client will accept.request-list is a space separated list of tokens.The Root request need not have been previously sent. valid-requests \n Response expected: yes.Ask the server to send back a Valid-requests response.The Root request need not have been previously sent. Directory local-directory \n Additional data: repository \n. Response expected: no.Tell the server what directory to use. The repository should be adirectory name from a previous server response. Note thatthis both gives a default for Entry and Modified andalso for ci and the other commands; normal usage is to sendDirectory for each directory in which there will be anEntry or Modified, and then a final Directoryfor the original directory, then the command.The local-directory is relative tothe top level at which the command is occurring (i.e. the lastDirectory which is sent before the command);to indicate that top level, ‘.’ should be sent forlocal-directory.Here is an example of where a client gets repository andlocal-directory. Suppose that there is a module defined by moddir 1dir That is, one can check out moddir and it will take 1dir inthe repository and check it out to moddir in the workingdirectory. Then an initial check out could proceed like this: C: Root /home/kingdon/zwork/cvsroot . . . C: Argument moddir C: Directory . C: /home/kingdon/zwork/cvsroot C: co S: Clear-sticky moddir/ S: /home/kingdon/zwork/cvsroot/1dir/ . . . S: ok In this example the response shown is Clear-sticky, but it couldbe another response instead. Note that it returns two pathnames.The first one, moddir/, indicates the workingdirectory to check out into. The second one, ending in 1dir/,indicates the directory to pass back to the server in a subsequentDirectory request. For example, a subsequent updaterequest might look like: C: Directory moddir C: /home/kingdon/zwork/cvsroot/1dir . . . C: update For a given local-directory, the repository will be the same foreach of the responses, so one can use the repository from whicheverresponse is most convenient. Typically a client will store therepository along with the sources for each local-directory, usethat same setting whenever operating on that local-directory, andnot update the setting as long as the local-directory exists.A client is free to rename a local-directory at any time (forexample, in response to an explicit user request). While it is truethat the server supplies a local-directory to the client, as notedabove, this is only the default place to put the directory. Of course,the various Directory requests for a single command (for example,update or ci request) should name a particular directorywith the same local-directory.Each Directory request specifies a brand-newlocal-directory and repository; that is,local-directory and repository are never relative to pathsspecified in any previous Directory request.Here's a more complex example, in which we request an update of aworking directory which has been checked out from multiple places in therepository. C: Argument dir1 C: Directory dir1 C: /home/foo/repos/mod1 . . . C: Argument dir2 C: Directory dir2 C: /home/foo/repos/mod2 . . . C: Argument dir3 C: Directory dir3/subdir3 C: /home/foo/repos/mod3 . . . C: update While directories dir1 and dir2 will be handled in similarfashion to the other examples given above, dir3 is slightlydifferent from the server's standpoint. Notice that module mod3is actually checked out into dir3/subdir3, meaning that directorydir3 is either empty or does not contain data checked out fromthis repository.The above example will work correctly in cvs 1.10.1 and later. Theserver will descend the tree starting from all directories mentioned inArgument requests and update those directories specificallymentioned in Directory requests.Previous versions of cvs (1.10 and earlier) do not behave the sameway. While the descent of the tree begins at all directories mentionedin Argument requests, descent into subdirectories only occurs ifa directory has been mentioned in a Directory request.Therefore, the above example would succeed in updating dir1 anddir2, but would skip dir3 because that directory was notspecifically mentioned in a Directory request. A functionalversion of the above that would run on a 1.10 or earlier server is asfollows: C: Argument dir1 C: Directory dir1 C: /home/foo/repos/mod1 . . . C: Argument dir2 C: Directory dir2 C: /home/foo/repos/mod2 . . . C: Argument dir3 C: Directory dir3 C: /home/foo/repos/. . . . C: Directory dir3/subdir3 C: /home/foo/repos/mod3 . . . C: update Note the extra Directory dir3 request. It might be better to useEmptydir as the repository for the dir3 directory, but theabove will certainly work.One more peculiarity of the 1.10 and earlier protocol is the ordering ofDirectory arguments. In order for a subdirectory to beregistered correctly for descent by the recursion processor, its parentmust be sent first. For example, the following would not work to updatedir3/subdir3: . . . C: Argument dir3 C: Directory dir3/subdir3 C: /home/foo/repos/mod3 . . . C: Directory dir3 C: /home/foo/repos/. . . . C: update The implementation of the server in 1.10 and earlier writes theadministration files for a given directory at the time of theDirectory request. It also tries to register the directory withits parent to mark it for recursion. In the above example, at the timedir3/subdir3 is created, the physical directory for dir3will be created on disk, but the administration files will not have beencreated. Therefore, when the server tries to registerdir3/subdir3 for recursion, the operation will silently failbecause the administration files do not yet exist for dir3. Max-dotdot level \n Response expected: no.Tell the server that level levels of directories above thedirectory which Directory requests are relative to will beneeded. For example, if the client is planning to use aDirectory request for ../../foo, it must send aMax-dotdot request with a level of at least 2.Max-dotdot must be sent before the first Directoryrequest. Static-directory \n Response expected: no. Tell the server that the directory most recentlyspecified with Directory should not haveadditional files checked out unless explicitly requested. The clientsends this if the Entries.Static flag is set, which is controlledby the Set-static-directory and Clear-static-directoryresponses. Sticky tagspec \n Response expected: no. Tell the server that the directory most recentlyspecified with Directory has a sticky tag or date tagspec.The first character of tagspec is ‘T’ for a tag, ‘D’for a date, or some other character supplied by a Set-sticky responsefrom a previous request to the server. The remainder of tagspeccontains the actual tag or date, again as supplied by Set-sticky.The server should remember Static-directory and Stickyrequests for a particular directory; the client need not resend themeach time it sends a Directory request for a given directory.However, the server is not obliged to remember them beyond the contextof a single command. Checkin-prog program \n Response expected: no. Tell the server that the directory most recentlyspecified with Directory has a checkin program program.Such a program would have been previously set with theSet-checkin-prog response. Update-prog program \n Response expected: no. Tell the server that the directory most recentlyspecified with Directory has an update program program.Such a program would have been previously set with theSet-update-prog response. Entry entry-line \n Response expected: no. Tell the server what version of a file is on thelocal machine. The name in entry-line is a name relative to thedirectory most recently specified with Directory. If the useris operating on only some files in a directory, Entry requestsfor only those files need be included. If an Entry request issent without Modified, Is-modified, or Unchanged,it means the file islost (does not exist in the working directory). If both Entryand one of Modified, Is-modified, or Unchanged aresent for the same file, Entry must be sent first. For agiven file, one can send Modified, Is-modified, orUnchanged, but not more than one of these three. Kopt option \n This indicates to the server which keyword expansion options to use forthe file specified by the next Modified or Is-modifiedrequest (for example ‘-kb’ for a binary file). This is similar toEntry, but is used for a file for which there is no entries line.Typically this will be a file being added via an add orimport request. The client may not send both Kopt andEntry for the same file. Checkin-time time \n For the file specified by the next Modified request, usetime as the time of the checkin. The time is in the formatspecified by RFC822 as modified by RFC1123. The client may specify anytimezone it chooses; servers will want to convert that to their owntimezone as appropriate. An example of this format is: 26 May 1997 13:01:40 -0400 There is no requirement that the client and server clocks besynchronized. The client just sends its recommendation for a timestamp(based on file timestamps or whatever), and the server should just believeit (this means that the time might be in the future, for example).Note that this is not a general-purpose way to tell the server about thetimestamp of a file; that would be a separate request (if there areservers which can maintain timestamp and time of checkin separately).This request should affect the import request, and may optionallyaffect the ci request or other relevant requests if any. Modified filename \n Response expected: no. Additional data: mode, \n, file transmission.Send the server a copy of one locally modified file. filename isa file within the most recent directory sent with Directory; itmust not contain ‘/’. Ifthe user is operating on only some files in a directory, only thosefiles need to be included. This can also be sent without Entry,if there is no entry for the file. Is-modified filename \n Response expected: no. Additional data: none. Like Modified,but used if the server only needsto know whether the file is modified, not the contents.The commands which can take Is-modified instead ofModified with no known change in behavior are: admin,diff (if and only if two ‘-r’ or ‘-D’ options arespecified), watch-on, watch-off, watch-add,watch-remove, watchers, editors,log, and annotate.For the status command, one can send Is-modified but ifthe client is using imperfect mechanisms such as timestamps to determinewhether to consider a file modified, then the behavior will bedifferent. That is, if one sends Modified, then the server willactually compare the contents of the file sent and the one it derivesfrom to determine whether the file is genuinely modified. But if onesends Is-modified, then the server takes the client's word forit. A similar situation exists for tag, if the ‘-c’ optionis specified.Commands for which Modified is necessary are co,ci, update, and import.Commands which do not need to inform the server about a workingdirectory, and thus should not be sending either Modified orIs-modified: rdiff, rtag, history,init, and release.Commands for which further investigation is warranted are:remove, add, and export. Pending suchinvestigation, the more conservative course of action is to stick toModified. Unchanged filename \n Response expected: no. Tell the server that filename has not beenmodified in the checked out directory. The filename isa file within the most recent directory sent with Directory; itmust not contain ‘/’. UseUnchanged \n Response expected: no. To specify the version of the protocol describedin this document, servers must support this request (although it neednot do anything) and clients must issue it.The Root request need not have been previously sent. Empty-conflicts \n Response expected: yes. This request is an alias for noop. Itspresence in the list of valid-requests is intended to be used as aplaceholder to alert the client that the server does not require the contentsof files with conflicts that have not been modified since the merge, foroperations other than diff. It was a bug in pre 1.11.22 & pre 1.12.14 serversthat the contents of files with conflicts was required for the server toacknowledge the existence of the conflicts. Notify filename \n Response expected: no.Tell the server that an edit or unedit command has takenplace. The server needs to send a Notified response, but suchresponse is deferred until the next time that the server is sendingresponses.The filename is a file within the most recent directory sent withDirectory; it must not contain ‘/’.Additional data: notification-type \t time \t clienthost \t working-dir \t watches \n where notification-type is ‘E’ for edit, ‘U’ forunedit, undefined behavior if ‘C’, and all other letters should besilently ignored for future expansion.time is the time at which the edit or unedit took place, in auser-readable format of the client's choice (the server should treat thetime as an opaque string rather than interpreting it). clienthost is the name of the host on which the edit or unedittook place, and working-dir is the pathname of the workingdirectory where the edit or unedit took place. watches are thetemporary watches, zero or more of the following characters in thefollowing order: ‘E’ for edit, ‘U’ for unedit, ‘C’ forcommit, and all other letters should be silently ignored for futureexpansion. If notification-type is ‘E’ the temporary watchesare set; if it is ‘U’ they are cleared.If watches is followed by \t then the\t and the rest of the line should be ignored, for future expansion.The time, clienthost, and working-dir fields may notcontain the characters ‘+’, ‘,’, ‘>’, ‘;’, or ‘=’.Note that a client may be capable of performing an edit orunedit operation without connecting to the server at that time,and instead connecting to the server when it is convenient (for example,when a laptop is on the net again) to send the Notify requests.Even if a client is capable of deferring notifications, it shouldattempt to send them immediately (one can send Notify requeststogether with a noop request, for example), unless perhaps ifit can know that a connection would be impossible. Questionable filename \n Response expected: no. Additional data: no. Tell the server to checkwhether filename should be ignored, and if not, next time theserver sends responses, send (in a M response) ‘?’ followedby the directory and filename. filename must not contain‘/’; it needs to be a file in the directory named by the mostrecent Directory request. Case \n Response expected: no. Tell the server that filenames should be matchedin a case-insensitive fashion. Note that this is not the primarymechanism for achieving case-insensitivity; for the most part the clientkeeps track of the case which the server wants to use and takes care toalways use that case regardless of what the user specifies. For examplethe filenames given in Entry and Modified requests for thesame file must match in case regardless of whether the Caserequest is sent. The latter mechanism is more general (it could also beused for 8.3 filenames, VMS filenames with more than one ‘.’, andany other situation in which there is a predictable mapping betweenfilenames in the working directory and filenames in the protocol), butthere are some situations it cannot handle (ignore patterns, orsituations where the user specifies a filename and the client does notknow about that file).Though this request will be supported into the forseeable future, it has beenthe source of numerous bug reports in the past due to the complexity of testingthis functionality via the test suite and client developers are encouraged notto use it. Instead, please consider munging conflicting names and maintaininga map for communicating with the server. For example, suppose the server sendsfiles case, CASE, and CaSe. The client could write allthree files to names such as, case, case_prefix_case, andcase_prefix_2_case and maintain a mapping between the file names in, forinstance a new CVS/Map file. Argument text \n Response expected: no.Save argument for use in a subsequent command. Argumentsaccumulate until an argument-using command is given, at which pointthey are forgotten. Argumentx text \n Response expected: no. Append \n followed by text to the currentargument being saved. Global_option option \n Response expected: no.Transmit one of the global options ‘-q’, ‘-Q’, ‘-l’,‘-t’, ‘-r’, or ‘-n’. option must be one of thosestrings, no variations (such as combining of options) are allowed. Forgraceful handling of valid-requests, it is probably better tomake new global options separate requests, rather than trying to addthem to this request.The Root request need not have been previously sent. Gzip-stream level \n Response expected: no.Use zlib (RFC 1950/1951) compression to compress all further communicationbetween the client and the server. After this request is sent, allfurther communication must be compressed. All further data receivedfrom the server will also be compressed. The level argumentsuggests to the server the level of compression that it should apply; itshould be an integer between 1 and 9, inclusive, where a higher numberindicates more compression. Kerberos-encrypt \n Response expected: no.Use Kerberos encryption to encrypt all further communication between theclient and the server. This will only work if the connection was madeover Kerberos in the first place. If both the Gzip-stream andthe Kerberos-encrypt requests are used, theKerberos-encrypt request should be used first. This will makethe client and server encrypt the compressed data, as opposed tocompressing the encrypted data. Encrypted data is generallyincompressible.Note that this request does not fully prevent an attacker from hijackingthe connection, in the sense that it does not prevent hijacking theconnection between the initial authentication and theKerberos-encrypt request. Gssapi-encrypt \n Response expected: no.Use GSSAPI encryption to encrypt all further communication between theclient and the server. This will only work if the connection was madeover GSSAPI in the first place. See Kerberos-encrypt, above, forthe relation between Gssapi-encrypt and Gzip-stream.Note that this request does not fully prevent an attacker from hijackingthe connection, in the sense that it does not prevent hijacking theconnection between the initial authentication and theGssapi-encrypt request. Gssapi-authenticate \n Response expected: no.Use GSSAPI authentication to authenticate all further communicationbetween the client and the server. This will only work if theconnection was made over GSSAPI in the first place. Encrypted data isautomatically authenticated, so using both Gssapi-authenticateand Gssapi-encrypt has no effect beyond that ofGssapi-encrypt. Unlike encrypted data, it is reasonable tocompress authenticated data.Note that this request does not fully prevent an attacker from hijackingthe connection, in the sense that it does not prevent hijacking theconnection between the initial authentication and theGssapi-authenticate request. Set variable=value \n Response expected: no.Set a user variable variable to value.The Root request need not have been previously sent. expand-modules \n Response expected: yes. Expand the modules which are specified in thearguments. Returns the data in Module-expansion responses. Notethat the server can assume that this is checkout or export, not rtag orrdiff; the latter do not access the working directory and thus have noneed to expand modules on the client side.Expand may not be the best word for what this request does. It does notnecessarily tell you all the files contained in a module, for example.Basically it is a way of telling you which working directories theserver needs to know about in order to handle a checkout of thespecified modules.For example, suppose that the server has a module defined by aliasmodule -a 1dir That is, one can check out aliasmodule and it will take1dir in the repository and check it out to 1dir in theworking directory. Now suppose the client already has this modulechecked out and is planning on using the co request to update it.Without using expand-modules, the client would have two badchoices: it could either send information about all workingdirectories under the current directory, which could be unnecessarilyslow, or it could be ignorant of the fact that aliasmodule standsfor 1dir, and neglect to send information for 1dir, whichwould lead to incorrect operation. With expand-modules, the client would first ask for the module tobe expanded: C: Root /home/kingdon/zwork/cvsroot . . . C: Argument aliasmodule C: Directory . C: /home/kingdon/zwork/cvsroot C: expand-modules S: Module-expansion 1dir S: ok and then it knows to check the 1dir directory and sendrequests such as Entry and Modified for the files in thatdirectory. ci \ndiff \ntag \nstatus \nadmin \nhistory \nwatchers \neditors \nannotate \n Response expected: yes. Actually do a cvs command. This uses anyprevious Argument, Directory, Entry, orModified requests, if they have been sent. Thelast Directory sent specifies the working directory at the timeof the operation. No provision is made for any input from the user.This means that ci must use a -m argument if it wants tospecify a log message. log \n Response expected: yes. Show information for past revisions. This usesany previous Directory, Entry, or Modifiedrequests, if they have been sent. The last Directory sentspecifies the working directory at the time of the operation. Also usesprevious Argument's of which the canonical forms are thefollowing (cvs 1.10 and older clients sent what the user specified,but clients are encouraged to use the canonical forms and other formsare deprecated): -b, -h, -l, -N, -R, -t These options go by themselves, one option per Argument request. -d date1<date2 Select revisions between date1 and date2. Either datemay be omitted in which case there is no date limit at that end of therange (clients may specify dates such as 1 Jan 1970 or 1 Jan 2038 forsimilar purposes but this is problematic as it makes assumptions aboutwhat dates the server supports). Dates are in RFC822/1123 format. The‘-d’ is one Argument request and the date range is a secondone. -d date1<=date2 Likewise but compare dates for equality. -d singledate Select the single, latest revision dated singledate or earlier.To include several date ranges and/or singledates, repeat the ‘-d’option as many times as necessary. -rrev1:rev2-rbranch-rbranch.-r Specify revisions (note that rev1 or rev2 can be omitted, orcan refer to branches). Send both the ‘-r’ and the revisioninformation in a single Argument request. To include severalrevision selections, repeat the ‘-r’ option. -s state-w-wlogin Select on states or users. To include more than one state or user,repeat the option. Send the ‘-s’ option as a separate argumentfrom the state being selected. Send the ‘-w’ option as part of thesame argument as the user being selected. co \n Response expected: yes. Get files from the repository. This uses anyprevious Argument, Directory, Entry, orModified requests, if they have been sent. Arguments to thiscommand are module names; the client cannot know what directories theycorrespond to except by (1) just sending the co request, and thenseeing what directory names the server sends back in its responses, and(2) the expand-modules request. export \n Response expected: yes. Get files from the repository. This uses anyprevious Argument, Directory, Entry, orModified requests, if they have been sent. Arguments to thiscommand are module names, as described for the co request. Theintention behind this command is that a client can get sources from aserver without storing CVS information about those sources. That is, aclient probably should not count on being able to take the entries linereturned in the Created response from an export requestand send it in a future Entry request. Note that the entriesline in the Created response must indicate whether the file isbinary or text, so the client can create it correctly. rannotate \nrdiff \nrlog \nrtag \n Response expected: yes. Actually do a cvs command. This uses anyprevious Argument requests, if they have been sent. The clientshould not send Directory, Entry, or Modifiedrequests for these commands; they are not used. Arguments to thesecommands are module names, as described for co. init root-name \n Response expected: yes. If it doesn't already exist, create a cvsrepository root-name. Note that root-name is a localdirectory and not a fully qualified CVSROOT variable.The Root request need not have been previously sent. update \n Response expected: yes. Actually do a cvs update command. Thisuses any previous Argument, Directory, Entry,or Modified requests, if they have been sent. Thelast Directory sent specifies the working directory at the timeof the operation. The -I option is not used–files which theclient can decide whether to ignore are not mentioned and the clientsends the Questionable request for others. import \n Response expected: yes. Actually do a cvs import command. Thisuses any previous Argument, Directory, Entry, orModified requests, if they have been sent. Thelast Directory sent specifies the working directory at the timeof the operation - unlike most commands, the repository field of eachDirectory request is ignored (it merely must point somewherewithin the root). The files to be imported are sent in Modifiedrequests (files which the client knows should be ignored are not sent;the server must still process the CVSROOT/cvsignore file unless -I ! issent). A log message must have been specified with a -margument. add \n Response expected: yes. Add a file or directory. This uses anyprevious Argument, Directory, Entry, orModified requests, if they have been sent. Thelast Directory sent specifies the working directory at the timeof the operation.To add a directory, send the directory to be added usingDirectory and Argument requests. For example: C: Root /u/cvsroot . . . C: Argument nsdir C: Directory nsdir C: /u/cvsroot/1dir/nsdir C: Directory . C: /u/cvsroot/1dir C: add S: M Directory /u/cvsroot/1dir/nsdir added to the repository S: ok You will notice that the server does not signal to the client in anyparticular way that the directory has been successfully added. Theclient is supposed to just assume that the directory has been added andupdate its records accordingly. Note also that adding a directory isimmediate; it does not wait until a ci request as files do.To add a file, send the file to be added using a Modifiedrequest. For example: C: Argument nfile C: Directory . C: /u/cvsroot/1dir C: Modified nfile C: u=rw,g=r,o=r C: 6 C: hello C: add S: E cvs server: scheduling file `nfile' for addition S: Mode u=rw,g=r,o=r S: Checked-in ./ S: /u/cvsroot/1dir/nfile S: /nfile/0/// S: E cvs server: use 'cvs commit' to add this file permanently S: ok Note that the file has not been added to the repository; the only effectof a successful add request, for a file, is to supply the clientwith a new entries line containing ‘0’ to indicate an added file.In fact, the client probably could perform this operation withoutcontacting the server, although using add does cause the serverto perform a few more checks.The client sends a subsequent ci to actually add the file to therepository.Another quirk of the add request is that with CVS 1.9 and older,a pathname specified inan Argument request cannot contain ‘/’. There is no goodreason for this restriction, and in fact more recent CVS servers don'thave it.But the way to interoperate with the older servers is to ensure thatall Directory requests for add (except those used to adddirectories, as described above), use ‘.’ forlocal-directory. Specifying another string forlocal-directory may not get an error, but it will get you strangeChecked-in responses from the buggy servers. remove \n Response expected: yes. Remove a file. This uses anyprevious Argument, Directory, Entry, orModified requests, if they have been sent. Thelast Directory sent specifies the working directory at the timeof the operation.Note that this request does not actually do anything to the repository;the only effect of a successful remove request is to supply theclient with a new entries line containing ‘-’ to indicate a removedfile. In fact, the client probably could perform this operation withoutcontacting the server, although using remove may cause the serverto perform a few more checks.The client sends a subsequent ci request to actually record theremoval in the repository. watch-on \nwatch-off \nwatch-add \nwatch-remove \n Response expected: yes. Actually do the cvs watch on, cvswatch off, cvs watch add, and cvs watch remove commands,respectively. This uses any previous Argument,Directory, Entry, or Modifiedrequests, if they have been sent. The last Directory sentspecifies the working directory at the time of the operation. release \n Response expected: yes. Note that a cvs release command hastaken place and update the history file accordingly. noop \n Response expected: yes. This request is a null command in the sensethat it doesn't do anything, but merely (as with any other requestsexpecting a response) sends back any responses pertaining to pendingerrors, pending Notified responses, etc.The Root request need not have been previously sent. update-patches \n Response expected: yes.This request does not actually do anything. It is used as a signal thatthe server is able to generate patches when given an updaterequest. The client must issue the -u argument to updatein order to receive patches. gzip-file-contents level \n Response expected: no. Note that this request does not follow theresponse convention stated above. Gzip-stream is suggestedinstead of gzip-file-contents as it gives better compression; theonly reason to implement the latter is to provide compression withcvs 1.8 and earlier. The gzip-file-contents request asksthe 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, inthe case of very small files, or files that already appear to becompressed) 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 thatit may compress files sent to the server, regardless of whether theclient actually uses this request. wrapper-sendme-rcsOptions \n Response expected: yes.Request that the server transmit mappings from filenames to keywordexpansion modes in Wrapper-rcsOption responses. version \n Response expected: yes.Request that the server transmit its version message.The Root request need not have been previously sent. other-request text \n Response expected: yes.Any unrecognized request expects a response, and does notcontain any additional data. The response will normally be something like‘error unrecognized request’, but it could be a different error ifa previous request which doesn't expect a response produced an error. When the client is done, it drops the connection. Introduction to Responses 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). Any set of responses always ends with ‘error’ or ‘ok’. This indicates that the response is over. The responses Checked-in, New-entry, Updated, Created, Update-existing, Merged, and Patched are refered to as file updating responses, because they change the status of a file in the working directory in some way. The responses Mode, Mod-time, and Checksum are referred to as file update modifying responses because they modify the next file updating response. In no case shall a file update modifying response apply to a file updating response other than the next one. Nor can the same file update modifying response occur twice for a given file updating response (if servers diagnose this problem, it may aid in detecting the case where clients send an update modifying response without following it by a file updating response). The "pathname" in responses Many of the responses contain something called pathname. The name is somewhat misleading; it actually indicates a pair of pathnames. First, a local directory name relative to the directory in which the command was given (i.e. the last Directory before the command). Then a linefeed and a repository name. Then a slash and the filename (without a ‘,v’ ending). 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 If the server wants to tell the client to create a directory, then it merely uses the directory in any response, as described above, and the client should create the directory if it does not exist. Note that this should only be done one directory at a time, in order to permit the client to correctly store the repository for each directory. Servers can use requests such as Clear-sticky, Clear-static-directory, or any other requests, to create directories. Some server implementations may poorly distinguish between a directory which should not exist and a directory which contains no files; in order to refrain from creating empty directories a client should both send the ‘-P’ option to update or co, and should also detect the case in which the server asks to create a directory but not any files within it (in that case the client should remove the directory or refrain from creating it in the first place). Note that servers could clean this up greatly by only telling the client to create directories if the directory in question should exist, but until servers do this, clients will need to offer the ‘-P’ behavior described above. Responses Here are the responses: Valid-requests request-list \n Indicate what requests the server will accept. request-listis a space separated list of tokens. If the server supports sendingpatches, it will include ‘update-patches’ in this list. The‘update-patches’ request does not actually do anything. Checked-in pathname \n Additional data: New Entries line, \n. This means a file pathnamehas been successfully operated on (checked in, added, etc.). name inthe Entries line is the same as the last component of pathname. New-entry pathname \n Additional data: New Entries line, \n. Like Checked-in, but thefile is not up to date. Updated pathname \n Additional data: New Entries line, \n, mode, \n, file transmission. Anew copy of the file is enclosed. This is used for a new revision of anexisting file, or for a new file, or for any other case in which thelocal (client-side) copy of the file needs to be updated, and afterbeing updated it will be up to date. If any directory in pathname doesnot exist, create it. This response is not used if Created andUpdate-existing are supported. Created pathname \n This is just like Updated and takes the same additional data, butis used only if no Entry, Modified, orUnchanged request has been sent for the file in question. Thedistinction between Created and Update-existing is sothat the client can give an error message in several cases: (1) there isa file in the working directory, but not one for which Entry,Modified, or Unchanged was sent (for example, a file whichwas ignored, or a file for which Questionable was sent), (2)there is a file in the working directory whose name differs from the onementioned in Created in ways that the client is unable to use todistinguish files. For example, the client is case-insensitive and thenames differ only in case. Update-existing pathname \n This is just like Updated and takes the same additional data, butis used only if a Entry, Modified, or Unchangedrequest has been sent for the file in question.This response, or Merged, indicates that the server hasdetermined that it is OK to overwrite the previous contents of the filespecified by pathname. Provided that the client has correctlysent Modified or Is-modified requests for a modified file,and the file was not modified while CVS was running, the server canensure that a user's modifications are not lost. Merged pathname \n This is just like 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, withor without conflicts.It is useful to preserve an copy of what the file looked like before themerge. This is basically handled by the server; before sendingMerged it will send a Copy-file response. For example, ifthe file is aa and it derives from revision 1.3, theCopy-file response will tell the client to copy aa to.#aa.1.3. It is up to the client to decide how long to keep thisfile around; traditionally clients have left it around forever, thusletting the user clean it up as desired. But another answer, such asuntil the next commit, might be preferable. Rcs-diff pathname \n This is just like Updated and takes the same additional data,with the one difference that instead of sending a new copy of the file,the server sends an RCS change text. This change text is produced by‘diff -n’ (the GNU diff ‘-a’ option may also be used). Theclient must apply this change text to the existing file. This will onlybe used when the client has an exact copy of an earlier revision of afile. This response is only used if the update command is giventhe ‘-u’ argument. Patched pathname \n This is just like Rcs-diff and takes the same additional data,except that it sends a standard patch rather than an RCS change text.The patch is produced by ‘diff -c’ for cvs 1.6 and later (seePOSIX.2 for a description of this format), or ‘diff -u’ forprevious versions of cvs; clients are encouraged to accept eitherformat. Like Rcs-diff, this response is only used if theupdate command is given the ‘-u’ argument.The Patched response is deprecated in favor of theRcs-diff response. However, older clients (CVS 1.9 and earlier)only support Patched. Mode mode \n This mode applies to the next file mentioned inChecked-in. Mode is a file update modifying responseas described in . Mod-time time \n Set the modification time of the next file sent to time.Mod-time is a file update modifying responseas described in .Thetime is in the format specified by RFC822 as modified by RFC1123.The server may specify any timezone it chooses; clients will want toconvert that to their own timezone as appropriate. An example of thisformat is: 26 May 1997 13:01:40 -0400 There is no requirement that the client and server clocks besynchronized. The server just sends its recommendation for a timestamp(based on its own clock, presumably), and the client should just believeit (this means that the time might be in the future, for example).If the server does not send Mod-time for a given file, the clientshould pick a modification time in the usual way (usually, just let theoperating system set the modification time to the time that the CVScommand is running). Checksum checksum\n The checksum applies to the next file sent (that is,Checksum is a file update modifying responseas described in ).In the case ofPatched, 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 checksumsdo not match. The checksum is the 128 bit MD5 checksum represented as32 hex digits (MD5 is described in RFC1321).This response is optional, and is only used if theclient supports it (as judged by the Valid-responses request). Copy-file pathname \n Additional data: newname \n. Copy file pathname tonewname in the same directory where it already is. This does notaffect CVS/Entries.This can optionally be implemented as a rename instead of a copy. Theonly use for it which currently has been identified is prior to aMerged response as described under Merged. Clients canprobably assume that is how it is being used, if they want to worryabout things like how long to keep the newname file around. Removed pathname \n The file has been removed from the repository (this is the case wherecvs prints ‘file foobar.c is no longer pertinent’). Remove-entry pathname \n The file needs its entry removed from CVS/Entries, but the fileitself is already gone (this happens in response to a ci requestwhich involves committing the removal of a file). Set-static-directory pathname \n This instructs the client to set the Entries.Static flag, whichit should then send back to the server in a Static-directoryrequest whenever the directory is operated on. pathname ends in aslash; its purpose is to specify a directory, not a file within adirectory. Clear-static-directory pathname \n Like Set-static-directory, but clear, not set, the flag. Set-sticky pathname \n Additional data: tagspec \n. Tell the client to set a sticky tagor date, which should be supplied with the Sticky request forfuture operations. pathname ends in a slash; its purpose is tospecify a directory, not a file within a directory. The client shouldstore tagspec and pass it back to the server as-is, to allow forfuture expansion. The first character of tagspec is ‘T’ fora tag, ‘D’ for a date, or something else for future expansion. Theremainder of tagspec contains the actual tag or date. Clear-sticky pathname \n Clear any sticky tag or date set by Set-sticky. Template pathname \n Additional data: file transmission (note: compressed file transmissionsare not supported). pathname ends in a slash; its purpose is tospecify a directory, not a file within a directory. Tell the client tostore the file transmission as the template log message, and then usethat template in the future when prompting the user for a log message. Set-checkin-prog dir \n Additional data: prog \n. Tell the client to set a checkinprogram, which should be supplied with the Checkin-prog requestfor future operations. Set-update-prog dir \n Additional data: prog \n. Tell the client to set an updateprogram, which should be supplied with the Update-prog requestfor future operations. Notified pathname \n Indicate to the client that the notification for pathname has beendone. There should be one such response for every Notifyrequest; if there are several Notify requests for a single file,the requests should be processed in order; the first Notifiedresponse pertains to the first Notify request, etc. Module-expansion pathname \n Return a file or directorywhich is included in a particular module. pathname is relativeto cvsroot, unlike most pathnames in responses. pathname shouldbe used to look and see whether some or all of the module exists onthe client side; it is not necessarily suitable for passing as anargument to a co request (for example, if the modules filecontains the ‘-d’ option, it will be the directory specified with‘-d’, not the name of the module). Wrapper-rcsOption pattern -k 'option' \n Transmit to the client a filename pattern which implies a certainkeyword expansion mode. The pattern is a wildcard pattern (forexample, ‘*.exe’. The option is ‘b’ for binary, and soon. Note that although the syntax happens to resemble the syntax incertain CVS configuration files, it is more constrained; there must beexactly one space between pattern and ‘-k’ and exactly onespace between ‘-k’ and ‘'’, and no string is permitted inplace of ‘-k’ (extensions should be done with new responses, not byextending this one, for graceful handling of Valid-responses). M text \n A one-line message for the user.Note that the format of text is not designed for machine parsing.Although sometimes scripts and clients will have little choice, theexact text which is output is subject to vary at the discretion of theserver and the example output given in this document is just that,example output. Servers are encouraged to use the ‘MT’ response,and future versions of this document will hopefully standardize more ofthe ‘MT’ tags; see . Mbinary \n Additional data: file transmission (note: compressed file transmissionsare not supported). This is like ‘M’, except the contents of thefile transmission are binary and should be copied to standard outputwithout translation to local text file conventions. To transmit a textfile to standard output, servers should use a series of ‘M’ requests. E text \n Same as M but send to stderr not stdout. F \n Flush stderr. That is, make it possible for the user to see what hasbeen written to stderr (it is up to the implementation to decide exactlyhow far it should go to ensure this). MT tagname data \n This response provides for tagged text. It is similar toSGML/HTML/XML in that the data is structured and a naive applicationcan also make some sense of it without understanding the structure.The syntax is not SGML-like, however, in order to fit into the CVSprotocol better and (more importantly) to make it easier to parse,especially in a language like perl or awk.The tagname can have several forms. If it starts with ‘a’to ‘z’ or ‘A’ to ‘Z’, then it represents tagged text.If the implementation recognizes tagname, then it may interpretdata in some particular fashion. If the implementation does notrecognize tagname, then it should simply treat data astext to be sent to the user (similar to an ‘M’ response). Thereare two tags which are general purpose. The ‘text’ tag issimilar to an unrecognized tag in that it provides text which willordinarily be sent to the user. The ‘newline’ tag is usedwithout data and indicates that a newline will ordinarily besent to the user (there is no provision for embedding newlines in thedata of other tagged text responses).If tagname starts with ‘+’ it indicates a start tag and ifit starts with ‘-’ it indicates an end tag. The remainder oftagname should be the same for matching start and end tags, andtags should be nested (for example one could have tags in thefollowing order +bold +italic text -italic-bold but not +bold +italic text-bold -italic). A particular start and end tag may bedocumented to constrain the tagged text responses which are validbetween them.Note that if data is present there will always be exactly onespace between tagname and data; if there is more than onespace, then the spaces beyond the first are part of data.Here is an example of some tagged text responses. Note that there isa trailing space after ‘Checking in’ and ‘initial revision:’and there are two trailing spaces after ‘<--’. Such trailingspaces are, of course, part of data. MT +checking-in MT text Checking in MT fname gz.tst MT text ; MT newline MT rcsfile /home/kingdon/zwork/cvsroot/foo/gz.tst,v MT text <-- MT fname gz.tst MT newline MT text initial revision: MT init-rev 1.1 MT newline MT text done MT newline MT -checking-in If the client does not support the ‘MT’ response, the sameresponses might be sent as: M Checking in gz.tst; M /home/kingdon/zwork/cvsroot/foo/gz.tst,v <-- gz.tst M initial revision: 1.1 M done For a list of specific tags, see . error errno-code text \n The command completed with an error. errno-code is a symbolicerror code (e.g. ENOENT); if the server doesn't support thisfeature, or if it's not appropriate for this particular message, it justomits the errno-code (in that case there are two spaces after‘error’). Text is an error message such as that provided bystrerror(), or any other message the server wants to use.The text is like the M response, in the sense that it isnot particularly intended to be machine-parsed; servers may wish toprint an error message with MT responses, and then issue aerror response without text (although it should be notedthat MT currently has no way of flagging the output as intendedfor standard error, the way that the E response does). ok \n The command completed successfully. Tags for the MT tagged text response The MT response, as described in , offers a way for the server to send tagged text to the client. This section describes specific tags. The intention is to update this section as servers add new tags. In the following descriptions, text and newline tags are omitted. Such tags contain information which is intended for users (or to be discarded), and are subject to change at the whim of the server. To avoid being vulnerable to such whim, clients should look for the tags listed here, not text, newline, or other tags. The following tag means to indicate to the user that a file has been updated. It is more or less redundant with the Created and Update-existing responses, but we don't try to specify here whether it occurs in exactly the same circumstances as Created and Update-existing. The name is the pathname of the file being updated relative to the directory in which the command is occurring (that is, the last Directory request which is sent before the command). MT +updated MT fname name MT -updated The importmergecmd tag is used when doing an import which has conflicts. The client can use it to report how to merge in the newly imported changes. The count is the number of conflicts. The newly imported changes can be merged by running the following command: cvs checkout -j tag1 -j tag2 repository MT +importmergecmd MT conflicts count MT mergetag1 tag1 MT mergetag2 tag2 MT repository repository MT -importmergecmd Example Here is an example; lines are prefixed by ‘C: ’ to indicate the client sends them or ‘S: ’ to indicate the server sends them. The client starts by connecting, sending the root, and completing the protocol negotiation. In actual practice the lists of valid responses and requests would be longer. C: Root /u/cvsroot C: Valid-responses ok error Checked-in M E C: valid-requests S: Valid-requests Root Directory Entry Modified Argument Argumentx ci co S: ok C: UseUnchanged The client wants to check out the supermunger module into a fresh working directory. Therefore it first expands the supermunger module; this step would be omitted if the client was operating on a directory rather than a module. C: Argument supermunger C: Directory . C: /u/cvsroot C: expand-modules The server replies that the supermunger module expands to the directory supermunger (the simplest case): S: Module-expansion supermunger S: ok The client then proceeds to check out the directory. The fact that it sends only a single Directory request which specifies ‘.’ for the working directory means that there is not already a supermunger directory on the client. C: Argument -N C: Argument supermunger C: Directory . C: /u/cvsroot C: co The server replies with the requested files. In this example, there is only one file, mungeall.c. The Clear-sticky and Clear-static-directory requests are sent by the current implementation but they have no effect because the default is for those settings to be clear when a directory is newly created. S: Clear-sticky supermunger/ S: /u/cvsroot/supermunger/ S: Clear-static-directory supermunger/ S: /u/cvsroot/supermunger/ S: E cvs server: Updating supermunger S: M U supermunger/mungeall.c S: Created supermunger/ S: /u/cvsroot/supermunger/mungeall.c S: /mungeall.c/1.1/// S: u=rw,g=r,o=r S: 26 S: int mein () { abort (); } S: ok The current client 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. After the user modifies the file and instructs the client to check it back in. The client sends arguments to specify the log message and file to check in: C: Argument -m C: Argument Well, you see, it took me hours and hours to find C: Argumentx this typo and I searched and searched and eventually C: Argumentx had to ask John for help. C: Argument mungeall.c It also sends information about the contents of the working directory, including the new contents of the modified file. Note that the user has changed into the supermunger directory before executing this command; the top level directory is a user-visible concept because the server should print filenames in M and E responses relative to that directory. C: Directory . C: /u/cvsroot/supermunger C: Entry /mungeall.c/1.1/// C: Modified mungeall.c C: u=rw,g=r,o=r C: 26 C: int main () { abort (); } And finally, the client issues the checkin command (which makes use of the data just sent): C: ci And the server tells the client that the checkin succeeded: S: M Checking in mungeall.c; S: E /u/cvsroot/supermunger/mungeall.c,v <-- mungeall.c S: E new revision: 1.2; previous revision: 1.1 S: E done S: Mode u=rw,g=r,o=r S: Checked-in ./ S: /u/cvsroot/supermunger/mungeall.c S: /mungeall.c/1.2/// S: ok Required versus optional parts of the protocol The following are part of every known implementation of the CVS protocol (except obsolete, pre-1.5, versions of CVS) 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, Directory, Entry, Modified, Unchanged, Argument, Argumentx, ci, co, update. Responses: ok, error, Valid-requests, Checked-in, Updated, Merged, Removed, M, E. A server need not implement Repository, but in order to interoperate with CVS 1.5 through 1.9 it must claim to implement it (in Valid-requests). The client will not actually send the request. Obsolete protocol elements This section briefly describes protocol elements which are obsolete. There is no attempt to document them in full detail. There was a Repository request which was like Directory except it only provided repository, and the local directory was assumed to be similarly named. If the UseUnchanged request was not sent, there was a Lost request which was sent to indicate that a file did not exist in the working directory, and the meaning of sending Entries without Lost or Modified was different. All current clients (CVS 1.5 and later) will send UseUnchanged if it is supported. Notes on the Protocol A number of enhancements are possible. Also see the file todo in the cvs source distribution, which has further ideas concerning various aspects of cvs, some of which impact the protocol. Similarly, the http://cvs.nongnu.org site, in particular the Development pages. The Modified request could be speeded up by sending diffs ratherthan entire files. The client would need some way to keep the versionof the file which was originally checked out; probably requiring the useof "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 allowlocal operation of cvs diff without arguments. The fact that pserver requires an extra network turnaround inorder to perform authentication would be nice to avoid. This relates tothe issue of reporting errors; probably the clean solution is to deferthe error until the client has issued a request which expects aresponse. To some extent this might relate to the next item (in termsof how easy it is to skip a whole bunch of requests until we get to onethat expects a response). I know that the kerberos code doesn't wait inthis fashion, but that probably can cause network deadlocks and perhapsfuture problems running over a transport which is more transactionoriented than TCP. On the other hand I'm not sure it is wise to makethe client conduct a lengthy upload only to find there is anauthentication failure. The protocol uses an extra network turnaround for protocol negotiation(valid-requests). It might be nice to avoid this by having theclient be able to send requests and tell the server to ignore them ifthey are unrecognized (different requests could produce a fatal error ifunrecognized). To do this there should be a standard syntax forrequests. For example, perhaps all future requests should be a singleline, with mechanisms analogous to Argumentx, or several requestsworking together, to provide greater amounts of information. Or theremight be a standard mechanism for counted data (analogous to that usedby Modified) or continuation lines (like a generalizedArgumentx). It would be useful to compare what HTTP is planningin this area; last I looked they were contemplating something calledProtocol Extension Protocol but I haven't looked at the relevant IETFdocuments in any detail. Obviously, we want something as simple aspossible (but no simpler). The scrambling algorithm in the CVS client and server actually supportmore characters than those documented in .Someday we are going to either have to document them all (but this isnot as easy as it may look, see below), or (gradually and with adequateprocess) phase out the support for other characters in the CVSimplementation. This business of having the feature partly undocumentedisn't a desirable state long-term.The problem with documenting other characters is that unless we knowwhat character set is in use, there is no way to make a passwordportable from one system to another. For example, a with a circle ontop might have different encodings in different character sets.It almost works to say that the client picks an arbitrary,unknown character set (indeed, having the CVS client know what characterset the user has in mind is a hard problem otherwise), and scramblesaccording to a certain octet<->octet mapping. There are two problemswith this. One is that the protocol has no way to transmit character 10decimal (linefeed), and the current server and clients have no way tohandle 0 decimal (NUL). This may cause problems with certain multibytecharacter sets, in which octets 10 and 0 will appear in the middle ofother characters. The other problem, which is more minor and possiblynot worth worrying about, is that someone can type a password on onesystem and then go to another system which uses a different encoding forthe same characters, and have their password not work.The restriction to the ISO646 invariant subset is the best approach forstrings which are not particularly significant to users. Passwords arevisible enough that this is somewhat doubtful as applied here. ISO646does, however, have the virtue (!?) of offending everyone. It is easyto say "But the $ is right on people's keyboards! Surely we can'tforbid that". From a human factors point of view, that makes quite abit of sense. The contrary argument, of course, is that a with a circleon top, or some of the characters poorly handled by Unicode, are onsomeone's keyboard.