version_selector

Version-selector syntax

APPLICABILITY


Product

Command Type

ClearCase


general information


ClearCase LT


general information


Attache


general information


Platform

UNIX


Windows

SYNOPSIS

branch-pathname/version-number
[ branch-pathname]/ label
[ branch-pathname/]{ query }
branch-pathname\version-number
[ branch-pathname] \label
[ branch-pathname\] { query }

DESCRIPTION

A version selector identifies a version of an element in a version tree. You can use it with the -version command-line option, as part of a rule in a config spec, and as part of a version-extended pathname. The version selector has three general forms. Each identifies a version in a different way:

A version selector selects one version of an element, no version of an element, or generates an error, if ambiguous.

Branch Pathnames

The branch pathname in a version selector identifies the branch on which a version resides. A branch pathname consists of a series of branch type names separated by slashes (UNIX) or backslashes (Windows). The root of a version tree is the main branch (default name: main), which must be the first entry in the branch pathname unless you use the ellipsis wildcard (not valid in version-extended pathnames). Examples:

/main

(main branch)

\main\bugfix

(bugfix branch, off the main branch)

/main/motif/bugfix

(bugfix branch, off the /main/motif branch)

\main\win32\bugfix\anne

(jpb branch, off the \main\win32\bugfix branch)

SELECTION BY VERSION-ID

Selects the version with the specified version-ID. This form requires a branch pathname.

Examples:

/main/2

(version 2 on main branch)

/main/bugfix/5

(version 5 on bugfix branch off main branch)

/main/motif/bugfix/1

(version 1 on subbranch of /main/motif branch)

In a version-extended pathname, the version-ID follows the element name and extended naming symbol (default: @@). For example:

hello.c@@\main\4

(version 4 on main branch of file 'hello.c')

include@@\main\4\hello.h\main\3

(version 3 on the main branch of file 'hello.h', in version 4 on the main branch of directory 'include')

RESTRICTION: In a version-extended pathname, you cannot use the ellipsis wildcard ( ... ):

include.h@@/.../bugfix/REL2

(is not valid)

SELECTION BY VERSION LABEL

Selects the version with the specified label. The branch pathname is optional, but the slash or backslash is required. Examples:

\main\LATEST

(most recent version on main branch)

...\bugfix\REL2

(version labeled REL2 on a branch named bugfix, at any branching level)

\main\bugfix\REL2

(version labeled REL2 on a bugfix branch that is a subbranch of main)

\main\sunport\openlook\BUG3

(version labeled BUG3 on a particular third-level branch)

REL2

(version labeled REL2 on any branch)

RESTRICTION: In a version-extended pathname, you cannot use the ellipsis wildcard ( ... ):

include.h@@/.../bugfix/REL2

(is not valid)

The label LATEST is predefined; it evaluates to the most recent version on each branch of an element. If the most recent version on the main branch is version 4, these two version selectors identify the same version:

\main\LATEST
\main\4

A version selector can consist of a standalone label, such as REL2. Standalone labels can be ambiguous, however. For example, /main/bugfix/REL2 and REL2 may or may not be equivalent for a given element:

Version Labels

Version labels appear as UNIX hard links or as additional Windows file-system objects in an element's directory tree in version-extended namespace. (See the pathnames_ccase reference page.) If a version label was defined to be one-per-element, an additional link/filesystem-object appears at the top level of an element's directory tree. For example, if BL3 is a one-per-element label, these version-extended pathnames are both unambiguous references to the same version:

hello.c@@/BL3
hello.c@@/main/bugfix/patch2/BL3

In effect, this feature allows you to reference a version without knowing its exact location in the version tree.

If a label was defined with the -pbranch option, it does not appear in the element's top-level extended namespace directory (as implied earlier). Thus, if the one-per-element label, BL3, and the one-per-branch label, TEST_LBT, was attached to version \main\1 of file hello.c, its top-level extended namespace directory would look like this:

Z:\myvob\pr1> cd hello.c@@

Z:\myvob\pr1> dir

BL3 main

SELECTION BY QUERY

Selects the version that satisfies the specified query. The branch pathname is optional.

The query expression consists of one or more query primitives and operators, organized according to the syntax rules listed in the query_language reference page. Enclose the query expression in braces ({ }).

UNIX-Quoting

Enclose the entire version selector in single quotes (' ')-or double quotes (" ") if it includes spaces or characters that have special meaning to the shell. Use double quotes to set off string literals within the query expression.

/main/{TESTED=="yes"}

(the latest version on the main branch for which the 'TESTED' attribute has the value 'yes')

{hltype"(design_spec,<-)"}

(the version on any branch that is the 'to' end of a hyperlink of type 'design_spec')

/main/bugfix/"{!lbtype(REL2)}"

(on bugfix branch, the latest version that is not labeled 'REL2)

"{created_by(jpb)&&pool(sr1)}"

(the version on any branch created by user 'jpb' which is stored in the 'sr1' storage pool)

Windows-Quoting

Additional quoting and/or character escaping conventions must be used, depending on the command interpreter you are using and whether or not you are using interactive mode cleartool.

The following examples assume interactive mode cleartool (cleartool> prompt), which removes the command interpreter's command-line processing behavior from consideration. In general, enclose the entire version selector in quotes if it includes spaces, and make sure to enclose string literals in double-quotes within the query expression.

\main\{TESTED=="yes"}

(the latest version on main branch for which 'TESTED' attr has value 'yes)

"{hltype(design_spec,<-)}"

(on any branch, version that's the 'to' end of a hyperlink of type 'design_spec')

\main\bugfix\"{!lbtype(REL2)}"

(on bugfix branch, the latest version that is not labeled 'REL2')

"{created_by(anne)&&pool(sr1)}"

(on any branch, the version created by user 'anne' and stored in the 'sr1' storage pool)

Branch Pathnames

If the version selector includes a branch pathname, the view_server selects the latest version on the branch that satisfies the query. If the version selector does not include a branch pathname, the view_server selects the version on any branch that satisfies the query. However, without a branch pathname, a query is ambiguous when more than one version of the element satisfies the query; versions on different branches, or two versions on the same branch, for example.

The version-selection operation fails if the query selects no version or is ambiguous.

A version-extended pathname can include a query, but is subject to the same restrictions as other version selectors of this form. That is, the query must select exactly one version to succeed. For example, this command displays the most recent version that has an attribute of type TESTED:

cat include.h@@/"{attype(TESTED)}"

Note the use of quotes to prevent interpretation of the brace and parenthesis characters. As an alternative, you can quote the entire pathname:

Z:\vob_incl> type "include.h@@\{attype(TESTED)}"

If multiple branches have versions with a TESTED attribute, the version selector used in the examples above is ambiguous, and an error occurs.

RESTRICTION: In a version-extended pathname, you cannot use both a branch pathname and a query:

cat "include.h@@/main/{attype(TESTED)}" (is not valid)

cat "include.h@@/main/rel2_bugfix/{attype(TESTED)}" (is not valid)

On UNIX systems, you can use the describe command to work around this restriction:

cat `cleartool describe -s -ver /main/rel2_bugfix/"{attype(TESTED)}" include.h`

SEE ALSO

config_spec, pathnames_ccase, query_language