co
Check out RCS revisions
SYNOPSIS
co [options] file ...
PARAMETERS
-rrev
Selects the revision to be retrieved. If no revision is specified, the latest revision on the default branch is used.
-l[rev]
Locks the retrieved revision for editing. If no revision is specified, the latest revision is locked.
-u[rev]
Same as -l, but unlocks the retrieved revision after placing it in the working directory. This is often used to view a read-only copy.
-q
Quiet mode; suppresses most diagnostics. Useful for scripting.
-prev
Sends the specified revision to standard output instead of creating a working file.
-f
Force overwriting of existing files even if they are writable.
-kb
Performs keyword substitution, but treats keyword values as binary data to avoid corrupting files when RCS is used to manage them.
-ko
Only preserves keyword values and omits the rest of the file content. Useful when extracting keyword history.
-ddate
Retrieves the latest revision checked in before the specified date.
-s
Suppresses keyword substitution when checking out a revision.
-V
Prints the RCS version number.
-x
Removes any locks held by the caller on the given file.
DESCRIPTION
The co
command retrieves revisions from a Revision Control System (RCS) file and locks them. It's primarily used for modifying files under RCS control, ensuring that only one person can edit a file at a time, preventing conflicting changes. When you 'check out' a file with co
, it extracts a specific revision (usually the latest) from the RCS file and places it in your working directory. The locking mechanism creates a lock file, preventing other users from checking out the same revision for modification. When editing is finished, the ci
command (check-in) uploads changes back to the RCS and unlocks it.
CAVEATS
co
relies on RCS files (usually named file,v
) being present and correctly configured. It is less commonly used today as more modern version control systems like Git and Mercurial have become prevalent.
KEYWORD SUBSTITUTION
RCS allows embedding special keywords (e.g., $Author$
, $Date$
, $Revision$
) within files. When a file is checked out, these keywords are automatically expanded with relevant information about the revision. co
handles this substitution, but options like -s
can disable it.
WORKING WITH BRANCHES
RCS supports branching, allowing multiple lines of development to occur simultaneously. co -rbranch
retrieves the latest revision on a specific branch. Understanding branch names and structures is essential for effective RCS usage.
Note: The usage of branch with co is a more advanced feature.
HISTORY
co
is a fundamental part of the RCS toolset, which was developed in the early 1980s. RCS was one of the earliest version control systems and was widely used for managing source code and other text-based files. Its design influenced later version control systems. While less popular now, understanding co
and RCS provides historical context for modern version control practices.