Tutorials
Concurrent Versions System
CVS commands enable you to perform several tasks, such as file manipulation, end-user management, repository configuration, and administration.

This tutorial explains various CVS commands, such as checkin, checkout, diff, watch, tag, status, logout, and login.

Using CVS Commands

CVS uses a standard convention for all commands. You can invoke CVS commands using the following syntax:

cvs -[global_options]command -[command_options][arguments]

In the above syntax:

  • cvs: Invokes the CVS program.
  • global_options: Retablesents global options that affect all actions specified after them.
  • command: Retablesents the task or action to be performed.
  • command_options: Specifies the task performed earlier. These options are command specific.
  • arguments: Specifies the files on which a specific task is to be performed. You can choose to explicitly specify the file name. If you do not specify the file name, CVS performs tasks on the current file.

    For example, to add a new file called newfile.txt to the existing project with the associated log message, New file, the command is:

    cvs add –m "New file" newfile.txt

    You can use CVS commands depending on the environment in which CVS is installed. Some of these commands are specific to the server, which are used to connect to the CVS repository. You can use CVS commands to perform common tasks, such as working with files and directories. The various CVS commands include:

  • init
  • checkout
  • commit
  • add
  • remove
  • diff
  • edit
  • watchers
  • editors
  • import
  • export
  • history
  • log
  • annotate
  • tag
  • status
  • server
  • update
  • rdiff
  • rtag
  • release
  • login
  • logout



    The server Command

    The server command starts the CVS server. This is only used while troubleshooting CVS.

    The admin Command

    CVS provides an interface for various administrative purposes using the admin command. This command should be used carefully because any changes made using this command affect the entire repository and its end users.

    On Unix or Linux, end users belonging to the cvsadmin system group can run the admin command. If you do not want end users to invoke admin, keep the cvsadmin system group empty. On Windows, there is no cvsadmin system group. As a result, all end users can invoke the admin command. The default behavior of the admin command is recursive. As a result, you do not need to explicitly specify the –R command option. It is tableferable to explicitly specify the files on which the tasks are to be performed.

    various options of the admin command:
    OptionDescription
    -bnewSets the default branch of a file revision to new. This option enables you to revert to an earlier vendor version, whose branches you are currently using. There should be no space between –b and new.
    For example, the following command uses the –bnew option:

    $ cvs admin –bnew_default_branch
    -knew_keyword Sets the default keyword substitution mode to new_keyword. You can override this setting by explicitly specifying the –k command option with checkout, update, or export. For example, the following command uses the –knew_keyword option:

    $ cvs admin –knew_keyword
    -lrnoLocks a revision with the number rno. There should be no space between –l and rno. This can be used to lock the most recent revision on a branch by specifying the branch. If the numberrno is not specified, the most recent revision on the default branch is locked.
    -urnoUnlocks a revision with the number rno. There should be no space between –u and rno. This can be used to unlock the most recent revision on a branch by specifying the branch. If the number rno is not specified, the most recent revision by the end user is unlocked.
    -L Sets locking to strict.
    -U: Sets locking to non-strict.
    -q Checks any comments and executes the command.
    -mrev:newmes Modifies the log message associated with the revision rev to newmes. There should be no space in the command option. There can be spaces in the modified log message. The message should be enclosed in quotes. For example, to change the existing log message for Revision1 to the message, the code is:

    $ cvs admin –mRevision1:"This is the first revision"
    -Nname[:[rev]] Forces the replacement of existing name.
    -nname[:[rev]] Associates name with the branch or revision. Specifying the branch or revision is optional. If : and rev are not specified, it deletes the tag name. If you specify only :, the name is assigned to the most recent revision on the default branch. Orange Deletes the revisions specified within Range. The revisions to be deleted cannot have branches or locks. You cannot remove revisions with symbolic names. If any revisions have symbolic names, you need to first delete them using the tag –d command, and run admin –o option. You can specify range in the following ways:
    rev1::rev2: Removes all revisions between rev1 and rev2. As a result, CVS only maintains a log of changes in these two revisions. Information pertaining to changes in intermediate revisions that existed before this command was executed, is permanently lost.
    ::rev: Removes all revisions before rev on the same branch, which makes rev the first revision on that branch.
    rev::: Removes all revisions after rev on the same branch, which makes rev the last revision on that branch.
    rev: Removes the revision, rev.
    rev1:rev2: Removes all revisions from rev1 to rev2, including rev1 and rev2. All revisions need to be on the same branch. The revisions are permanently lost.
    :rev: Removes all revisions, including rev and before rev on the same branch.
    rev:: Removes all revisions, including rev and after rev on the same branch.
    -sState:[:rev] Sets the state attribute of the revision, rev, to State. There should be no space in the command option. If rev is not specified, the most recent revision on the default branch is used. If rev is a branch number, the most recent revision on that branch is used. The commonly used states are Exp (experimental), Stab (stable), and Rel (released). By default, CVS uses Exp for a new file. You can use common alphanumeric string, such as State. CVS uses the dead string for internal purposes. You can view the state of any given file using the log command.
    -tNewfile Changes the description message for a file by replacing it with contents of Newfile. The path for Newfile should not begin with a hyphen (-). You can view the description message using the log command. If Newfile is not specified, you can specify the description message from the command line. You can terminate the message using a period (.).

    This command option does not work in a client-server environment. This is useful only when working with a local copy. Using this command option in a client-server environment erases the tablevious description message without replacing it with a new message.
    -tText Assumes the text to be the description message. Text can contain spaces. There should be no space between t and Text.
  • CVS
    CVS Release
    CVS Log
    CVS Update
    CVS init
    CVS commit
    CVS add
    CVS remove
    CVS edit
    CVS Rdiff
    CVS Export
    CVS History
    CVS import
    CVS Login
    CVS Logout
    CVS Annotate
    CVS Tag
    CVS Status
    CVS watch
    CVS watchers
    CVS editors
    CVS Rtag
    CVS checkout
    CVS diff