Mapping CVS Terms and Commands to Perforce
A comparison of features, terminology, and commands in Perforce and CVS.
This comparison is for the experienced CVS user who is new to Perforce. The following comparisons are high-level and intended to help you take advantage of your CVS knowledge to learn Perforce.
The following table lists some general observations about CVS functionality compared to Perforce:
|In CVS||In Perforce|
|You perform a checkout to create or update a working directory. The working directory contains copies of the source files specified by modules.||You perform a sync to update your client workspace according to the client workspace mapping you are using.|
|By default, you make changes and then tell CVS about them (unless "watch" is turned on - then you must first open a file(s) for edit before changing it).||You open a file(s) (add, edit, delete, integrate, and so on), make the change(s) and then submit the changes.|
|Changes can be submitted for multiple files at once, but CVS does not ensure or track that the changes were submitted together.||Changes are grouped into changelists - an atomic change transaction for a set of changes all submitted together (along with a user derived description of the changes made).|
|"modules" and/or operating system wildcards are used for aggregate
||filespecs (file specifications) are used for aggregate operations.|
|CVS ignores file permissions and ownerships when storing files in the repository.||File type modifiers can be set and tracked in the metadata on the server machine.|
|You lock files using admin -l.||You lock files using the lock command or the +l filetype modifier in the add / edit & reopen commands (sets the exclusive open filetype flag).|
|You can mark important file revisions with tags.||You can mark/tag important file revisions by branching them to a release or QA branch line, or tagging them with labels.|
|You control access to the repository by changing permissions on directories in the CVSROOT path (users need write permission to check out files).||You control access by assigning permissions ( protect ) to users for all or part of the depot(s).|
|You can configure multiple repositories and access them with the global -d option.||You can set up multiple repositories (depots) for a server. Users use a client view specification to map the different depots or parts of depots into their workspace (users can have multiple client views). This can also include access to (read only) remote depots on other perforce servers. Or, you can use the -p global option to access different servers as well.|
|Supports text file type. Binary files are stored by turning off line-ending conversion and keyword expansion.||Supports seven base file types: text files, binary files, unicode files, native apple files on the Macintosh, Mac resource forks, UTF16 files, and UNIX symlinks. File type modifiers are then applied to the base types allowing for support of RCS keyword expansion, file compression on the server, and more. Perforce attempts to detect the file type and set it accordingly (which can be overridden). By default, binary files are stored compressed.|
The following table compares CVS terms to their Perforce equivalents.
|CVS term||Perforce term|
|reserved checkout||lock or exclusive-open|
|work tree||client workspace|
The following table lists CVS commands and their closest Perforce equivalents.
|CVS command||Perforce command(s)||Description||Remarks|
|add||add||CVS: Schedule the file for addition to the repository.
Perforce: Opens files within the client workspace for addition to the depot. The specified file(s) are linked to a changelist.
|To place the files into the source repository /depot:
Perforce: submit (the changelist is sent to the server)
-t [type] +k
|Set RCS keyword substitution.||Perforce: The file type modifier +k is applied to the base types to allow for support of RCS keyword expansion.|
|admin -kb or
|Set file type to binary.||CVS: Defaults to text type, -kb turns off line ending conversion and keyword
Perforce: Attempts to determine the file's type when a file is opened with add - this can be overridden with the -t option or the typemap command. Binary files are stored compressed.
-t [type] +l
|Lock a file revision.||CVS: Called a "reserve checkout" (where only one user can edit a given
file at a time).
Perforce: lock allows anyone to open the file for edit, but only the person who locked the file can submit it. By contrast, a file with attribute +l allows only one person to open the file for edit (exclusive open).
|annotate||annotate||Show last revision where each line was modified.||Perforce: With the -a option, all lines, including deleted lines and lines no longer present at the head revision, are included and each line includes a starting and ending revision.|
|checkout||sync & edit||Obtain copy of source and open file for edit.||CVS: Unless watch is on, files can be changed once they
are checked out.
Perforce: sync populates the client workspace. Use edit to open file(s) for edit.
|checkout/update -j||integrate & resolve||Merge changes from the revision specified.||
|checkout/update -P||client & sync||Prune empty directories.||Perforce: set the "rmdir" option in the client specification and empty directories are removed ("pruned") during a sync.|
|commit||submit||Check files into the repository.||CVS: Changes can be submitted for multiple files but CVS does not ensure or track
that they were submitted together.
Perforce: Changes are grouped into changelists - an atomic change transaction for a set of files all submitted together.
|diff||diff||Show differences between revisions.||CVS: The default action is to compare your working files with the
revisions they were based on.
Perforce: Compares files in the client workspace to revisions in the depot.
|rdiff||diff2||Show differences between releases.||CVS: diff files between two releases, operates directly from the repository.
Perforce: Compares two file revisions from the depot.
|diff/rdiff -c||diff/diff2 -du||Produce a "context diff" for use with the patch(1) utility.||
|edit||edit||Tell the system you are modifying a file.
||CVS: Used when "watch" is on.
Perforce: When a file is opened for edit, it is associated with a changelist for submission of the changes.
|editors||changes -s pending||CVS: See who is editing a file.
Perforce: List pending changelists.
|CVS: Only useful if "watch" is on.
Perforce: Use describe to view more information about a changelist.
|export||N/A||Create a copy of the source without the CVS admin files.||Perforce: Sync can be used but requires the use of a client workspace. Also, there are no admin files in the client workspace (all the admin information is tracked on the server side in the metadata database).|
|history||p4d -v server=[level]||Show command history.||CVS: Only valid if history logging is turned on. Tracks each use of the
checkout, commit, rtag, update, and release commands.
Perforce: Turns on command tracing in the server (level 1 logs server commands), which is logged into the server log.
|import||add, integ(rate)||Incorporate or update an entire source distribution from an outside source (for example, a source vendor) into your source repository directory.||Perforce: See KB Article #15 Creating a Vendor Branch for Third-party Source Code|
|init||depot||Set up a new repository (depot).||
|log||files, filelog, where||Display log information for files.||
|login, logout, pserver||passwd, -P [password] [command], login, logout||Set up authentication.||Perforce: By default, user records are created without passwords. A user can use the passwd command to set the password, and then provide the password to commands using the -P option or by setting the P4PASSWD environment variable.|
|release||sync [file(s)]#none||Remove working copy.||CVS: the release command only works on an entire directory (module).
Perforce: You can sync to "#none" for a file or set of files.
|remove||delete||Remove a file from the repository (depot).||Leaves the previous revisions intact. To apply the changes in the repository/depot:
|rtag, tag||label & labelsync -a tag||Tag files with a label.||
|rtag/tag -b||integrate||Create a branch.||
|status||files, fstat||Display information about workspace files.||Perforce:Other commands that show information about workspace files: sync -n, opened, have, and resolved.|
|unedit||revert||Undo an edit.||CVS: Only useful if "watch" is on.
Perforce: Note: the revert command does not display a warning before discarding edits!
|update||sync||Bring the workspace in sync with the repository.||
|update -j||integrate & resolve||Merge changes from a branch.||
|watch add||user, reviews & the Review daemons||Tell the SCM system to notify you when the file is changed.||CVS: notification can be provided when a file is opened for edit,
unedit(ed), or commited.
Perforce: Notification is provided when the files are checked in.
|watchers||reviews||See who wants to be notified about changes
to a file.