2. AccuRev® Command-Line Reference : anc

anc
Determine the ancestor of a version
Usage
accurev anc [ -v <ver-spec> ] [ -j | -J | -1 ] [ -fx ] <element>
accurev anc [ -v <numeric-ver-spec> ] [ -p <depot> ] [ -j | -J | -1 ]
[ -fx ] <element>
accurev anc -c -v <ver-spec> [ -fx ] <element>
accurev anc -c -v <numeric-ver-spec> [ -p <depot> ] [ -fx ] <element>
Description
The anc command determines one of the following:
In its simplest form (no command-line options), anc reports the direct ancestor of the version in your workspace for the specified element.
Version in the Workspace
Some forms of this command process “the version in your workspace”. This means the version currently in the workspace stream. anc always ignores the file, if any, in the workspace tree. Thus, the “anc” of a modified file element is not the version that you started editing.
Predecessor Algorithm
With no options, anc determines the predecessor of the version in your workspace. With just the -v option, it determines the predecessor of the specified version. The algorithm it uses in both these cases is:
1.
2.
Previous Occupant Algorithm
The -1 option (“dash-one”, meaning “the previous one”) uses a different algorithm, which finds the “previous occupant” of a workspace or stream. (This algorithm is also used by the diff -1 command.) The -1 option finds the version that was in a workspace or stream just before the specified version was created there:
1.
Consider the version specified with -v (default: the version in your workspace stream).
2.
3.
4.
For a real version in a workspace stream, this option yields the same result as the “predecessor algorithm” described above. That is, adding this option doesn’t change the command’s result. But specifying -1 does change the result for a version created in a workspace stream by a co or anchor command; these commands create a virtual version in a workspace stream, not a real version.
For a virtual version in a dynamic stream or snapshot, the previous-occupant result may or may not be the same as the predecessor result.
Options
-c
Determine the common ancestor of (1) the version in your workspace and (2) the version you specify with -v.
-fx
Display the results in XML format.
-j
Instead of determining the direct ancestor of the specified version, determine the corresponding basis version. See the patch reference page for more information on the basis version.
-J
This option is an alternative to -j when used in combination with -v.
The command anc -v rose_dvt_john/6 -j finds the basis version corresponding to version rose_dvt_john/6 of an element.
The command anc -v rose_dvt_john/6 -J considers two versions of the element: (#1) that same basis version and (#2) the common ancestor of version rose_dvt_john/6 and the version in your workspace.
If version #2 is a direct descendant of version #1, then anc reports version #2 as the result. This occurs when a merge was performed to your workspace from one of the versions between the basis version and version rose_dvt_john/6.
If version #2 is not a direct descendant of version #1, then anc reports version #1 as the result. In this case, -J produces the same result as -j.
-1
(“dash-one”) Determine the version that was in the workspace or stream just before the specified version was created. The result is reported as a real version, even if you are “looking backward” in a dynamic stream. See Previous Occupant Algorithm above.
Note: this option is designed to be used with -v. Be sure to specify a complete version-ID — for example, -v rose_dvt/14, not -v rose_dvt.
-p
The depot that the specified version resides in. Used with all-numeric versions.
-v <ver-spec>, -v <numerical-ver-spec>
The version whose ancestor is to be determined. If you omit this option, anc uses the version in the workspace stream. If you specify the version using numbers for both stream and version (16/1, for example) while not in a workspace, you must also specify a depot using -p.
Examples
Determine the direct ancestor of the current version of element brass.h:
> accurev anc brass.h
Determine the direct ancestor of version tulip_dvt/14 of element brass.h:
> accurev anc -v tulip_dvt/14 brass.h
Determine the basis version corresponding to the current version of element brass.h:
> accurev anc -j brass.h
Determine the common ancestor of the current version of element brass.h and version tulip_dvt_mary\3:
> accurev anc -c -v tulip_dvt_mary\3 brass.h
Determine the common ancestor of the current version of element brass.h and version 33\3 in depot cctulip:
> accurev anc -c -v 33\3 -p cctulip brass.h
Determine the version of brass.h that was in stream eagle_dvt just before version eagle_dvt/4 was created by promote:
> accurev anc -v eagle_dvt/4 -1 brass.h
See Also
diff, merge, mergelist, patch
Using a Specific Version of an Element
Real Versions and Virtual Versions of the AccuRev Concepts Manual

Micro Focus