1. Overview of the AccuRev® Command-Line Interface : What About All the Other Commands?

What About All the Other Commands?
The preceding sections focus on the day-to-day AccuRev tasks — and the accurev commands — that you are most likely to perform as a developer. The remainder of this chapter provides an overview of the entire CLI, with the discussion organized into broad functional categories. Each command will be discussed in much less depth than in the preceding sections. For full details, see the chapter AccuRev® Command-Line Reference.
Managing a Depot’s Stream Hierarchy
 
The repository can contain any number of depots, each of which is a distinct version-controlled directory hierarchy. Each depot contains a stream hierarchy, which structures the development process for the files in that depot. A depot’s stream hierarchy consists of dynamic streams, snapshots, workspaces, and reference trees.
Most of the management commands in this category begin with “mk” (create/make a data structure) or “ch” (change the specifications of an existing data structure).
The mkdepot command creates a new depot. You can rename an existing depot (chdepot), or change the location of the depot’s on-disk storage (chslice).
The mkstream command creates a new dynamic, pass-through, or gated stream. You can change the specifications of an existing stream: its name, its location in the stream hierarchy, and (for dynamic streams) its basis time (chstream).
The mksnap command creates a new snapshot. Since a snapshot is, by definition, immutable, there is no “change snapshot” command.
The mkws command creates a new workspace. You can change the specifications of an existing workspace: its name, its location in the stream hierarchy, its location in your computer’s (or your network’s) disk storage, and several additional parameters (chws).
The mkref command creates a new reference tree. You can change the specifications of an existing reference tree (chref).
The remove and rmws command remove these data structures from use.
Managing and Creating New Versions of Files
 
move, mv
The idea that an element is either active or passive in your workspace is essential to understanding many of the commands in this category. Typically, as you develop a file, you’ll keep one or more versions, then promote the most recent one, then keep another version, then promote that one, etc. During the “keep phase” of this cycle, your workspace has a private version of the file, containing changes that don’t exist anywhere else. The element is said to be active in your workspace. When you promote a version to the backing stream or demote a version to a child stream, the element becomes passive in your workspace. In this state, the public version of the element in the backing stream is the same as the version in your workspace.
Note: the elements that are currently active in your workspace are said to be in the workspace’s default group.
The add command (see Placing Files Under Version Control above) places a file under version control. That is, it converts an ordinary file in your workspace into a new AccuRev element. The new element becomes active in your workspace. The ln command creates a link object — one that points to an element (element link) or one that contains a pathname (symbolic link) that may or may not indicate an element.
The keep command (see Checkpointing — Saving Private Versions) creates a new version of a element in your workspace and makes the element active (if it isn’t already). Several other commands make an element active in your workspace:
The defunct command removes an element from your workspace. The undefunct command restores a previously defuncted element to your workspace.
The merge command (see Incorporating Other Users’ Work into Your Workspace) creates and keeps a new version of a file — and so does the patch command. The new version combines the contents of the file in your workspace and with all the changes in another version (merge) — or just with the most recent changes in another version (patch).
The move (or mv) command changes the pathname of an element — renaming it within the same directory or moving it to another directory in the same workspace/depot.
The revert command creates a new version by performing a “subtractive merge” of the specified version from the version in your workspace. See the description of revert for details. To “revert” to the version from the backing stream, use the purge command instead (described below).
All of the above commands make a change to the element, and record that change as a new version in the workspace. (Yes, even defunct creates a new version, recording the removal of the element.)
The following commands also make an element active, creating a new version in the workspace. But these commands don’t record any new change to the element; they merely transition the element from passive to active:
The anchor command takes an element that is currently passive (a version is being inherited from the backing stream) and declares it to be active. Note that this doesn’t make any change to the file in the workspace.
The co (“checkout”) command extends anchor by enabling you to make any historical version of an element — not just the current version — active in your workspace. The co command copies that version from the repository to your workspace, enabling you to examine and/or edit it.
The promote, demote, and purge commands transition an element from active status to passive status in the from-stream. promote (see Making Your Changes Public) takes a private version — created by keep or move or defunct, etc. — and makes it public by sending it to the backing stream. demote removes (or pulls back) a version from the default group in a parent stream and makes that version active in a child stream. purge effectively discards all the private versions of the element you’ve created recently; your workspace reverts to the version it was using before you made the element active.
The update command (see Incorporating Other Users’ Work into Your Workspace) copies recently-created versions into your workspace, replacing older files with newer files. It only updates elements that are passive in your workspace, leaving alone elements that are active unless you use update –m. The pop command is designed to “fill in the gaps”: it copies in the appropriate version of specified elements that are currently missing from the workspace.
The chmod command manipulates the UNIX/Linux-level executable bits on an element. The touch command updates the timestamp on a workspace file. This can affect the results of several file-status commands that use timestamps to optimize their performance. The start command launches a new command shell, with the current directory set to a specified workspace.
Getting Status Information
 
alias for cat command
The info command lists basic data about your AccuRev setup: username, client and server machine information, workspace and backing streams, etc.
The show command lists the names of items in the repository: depots, streams, workspaces, etc.
The files and stat commands (see Determining the Status of Files) list the status of elements in a workspace, or in a stream. The name command lists the pathname of an element, given its unique element-ID. This is particularly useful when an element has been renamed, and so appears under different names to different users. The anc command has options to determine several kinds of ancestor versions of a specified version (or the common ancestor of two versions). The wip command (see Tracking Other Users’ Work) lists the files under active development in the entire set of workspaces based on a particular stream.
The hist command lists the transaction history of individual elements, or of entire streams or depots.
The cat (or type) command retrieves the contents of a specified version of a file. The annotate command lists the contents of a specified version, indicating information about how each line of the file was created or modified.
The diff command compares two versions of a text file.
The translist command considers the set of elements that have versions pending promotion in a particular workspace or stream; it lists the transactions that created those versions. The mergelist command lists the files that need to be merged from one specified stream to another. Similarly, the patchlist command considers two versions of a text file, and lists all the individual versions that have changes present in one version but not the other.
Include/Exclude Rule Facility
 
AccuRev’s include/exclude facility makes it easy to include just the files you need in a workspace or stream. The incl, incldo, and excl command create these rules. The clear command deletes a rule. The lsrules command lists the rules. The mkrules command specifies multiple include/exclude rules to apply in a single file.
Administration
 
replica sync
AccuRev has remarkably little administrative overhead. There’s no need to stop the AccuRev Server process, even when using the backup command to back up the AccuRev metadata.
The mktrig and rmtrig commands maintain the triggers, which control users’ ability to make changes to depots.
The synctime command adjusts a client machine’s system clock to match that of the AccuRev server machine.
The diag command displays AccuRev performance figures.
The archive, unarchive, and reclaim commands manage the archiving of storage container files that can be moved to offline storage — for example, because they are no longer needed.
At a site that uses a replica of the master AccuRev repository, the mkreplica and rmreplica commands maintain the set of depots that are replicated at that site. The replica sync command performs a manual synchronization of the replica repository with the master repository.
Managing Users and Security
 
The AccuRev database’s site schema contains a registry of users (with optional password protection) and user groups. Access to repository data structures is controlled by stream locks and ACLs (access control lists). Access to particular CLI commands is controlled by triggers.
The mkuser command allocates a unique numeric user-ID, and assigns it a new username; it optionally sets a password for the user. The chuser and chpasswd commands change the name and password settings for an existing user-ID.
Similarly, the mkgroup and chgroup commands maintain the AccuRev user-group names. User membership in groups is maintained with the addmember, rmmember, and ismember commands.
The lock and unlock commands control stream locks, which control the promotion of versions to and from particular streams.
The setacl and lsacl commands maintain access control lists, which control users’ and groups’ ability to make changes to particular streams, or to particular depots.
Managing Change Packages
 
AccuRev change packages are implemented using the AccuWork issue management facility. Each issue record has a Changes tab, which can record a group of changes made to a set of elements. The cpkadd and cpkremove command maintain these Change tab entries, which are termed change packages. The cpkdescribe command lists the contents of a change package. The issuelist command shows which change packages (issue records) have their changes included in a particular stream. The issuediff command compares two streams in terms of their change packages.

Micro Focus