The annotate command lists the contents of a version, annotating each line to indicate when, and in which version, the line was added. You can customize the annotations using the –fmt option, which is described in the fmt_ccase reference page. By default, annotate writes its output to a file with the .ann extension.
Each version has a line of descent, a sequence of ancestor versions going all the way back to version 0 on the main branch. The default listing has a header section that includes the event records of all the versions in the line of descent of the annotated version.
The annotate command extracts information from the element's versions. To do so, it invokes the annotate method of the element's type manager. Only the text_file_delta and z_text_file_delta type managers (which correspond to the predefined element types text_file and compressed_text_file) include an annotate method. You must use the –ndata option when annotating versions of other element types.
The default report format includes the following components:
If you use the –rm or –all option, the report also includes deletion annotations. These appear on text lines that are not in the annotated version, but do exist in some other version of the element.
If you use this option when annotating more than one version, output-pname must be a directory.
Use a hyphen (-) to designate a default format string. For example, to supply a hdr-format, but not a primary annotation format, use the construction –fmt –, hdr-format. It is usually desirable to terminate the hdr-format with a <NL> character, by using \n.
If you omit the elide-format, it is computed based on the primary line-by-line annotation: all characters except <TAB> and the vertical bar (|) in the primary annotation are replaced by <SPACE>, and the middle character, if it is a <SPACE>, is replaced by a period (.).
In general, it is simpler to use fixed-width fields, not <TAB>-character specifiers (\t), to create aligned columns of annotations. See the fmt_ccase reference page for more details on composing format strings.
The UNIX examples in this section are written for use in csh. If you use another shell, you may need to use different quoting and escaping conventions.
The Windows examples that include wildcards or quoting are written for use in cleartool interactive mode. If you use cleartool single-command mode, you may need to change the wildcards and quoting to make your command interpreter process the command appropriately.
In cleartool single-command mode, cmd-context represents the UNIX shell or Windows command interpreter prompt, followed by the cleartool command. In cleartool interactive mode, cmd-context represents the interactive cleartool prompt.
Note: In the UNIX examples that follow, arguments and output that show multicomponent VOB tags are not applicable to ClearCase LT, which recognizes only single-component VOB tags. In this manual, a multicomponent VOB tag is by convention a two-component VOB tag of the form /vobs/vob-tag-leaf—for example, /vobs/src. A single-component VOB tag consists of a leaf only—for example, /src. In all other respects, the examples are valid for ClearCase LT.
cmd-context annotate -short msg.c
Annotated result written to "msg.c.ann".
% cat msg.c.ann
/vobs/src/msg.c
---------------
24-Apr-99 anne /main/rel2_bugfix/9
12-Mar-99 ravi /main/rel2_bugfix/8
.
.
.
23-Apr-99 rks /main/48 (REL2)
20-Apr-99 spc /main/47
.
.
.
-------------------------------------------------
-------------------------------------------------
20-May-98 | #include "hello.h"
. |
. | char *
21-Apr-99 | env_user() {
. | char * user_env;
. | user_env = getenv("USER");
.
.
.
. | time_t clock;
24-Mar-99 | char *s;
20-Sep-98 |
14-Jun-99 | s = ctime(&clock);
. | s[ strlen(s)-1 ] = ' ';
. | return s;
20-May-98 | }
cmd-context annotate -long msg.c
Annotated result written to "msg.c.ann".
type msg.c.ann
02-Apr-99.10:51:54 ##### Steve (scd.user@reach)\main\rel2_bugfix\1
a test
.
.
.
-------------------------------------------------
-------------------------------------------------
##### 01-Apr-99.16:19:25 scd \main\1 | #include "hello.h"
##### 02-Apr-99.10:51:54 scd \main\rel2_bugfix\1 | /* a test */
##### 01-Apr-99.16:19:25 scd \main\1 |
.
.
.
##### . |char *
##### . | hello_msg() {
.
.
.
cmd-context annotate -out - -fmt "-,Version %Vn created by %u.\n" util.c
version \main\3 created by anne.
version \main\2 created by anne.
version \main\1 created by rick.
version \main\0 created by rick.
-------------------------------------------------
-------------------------------------------------
# 20-May-98 rick \main\1 | #include "hello.h"
# . |
# . | char *
# . | env_user() {
### 08-Feb-99 anne \main\3 | char *str = getenv("USER");
### . | if ( strcmp(str,"root") == 0 )
.
.
.
Copyright© 2003 Rational Software. All Rights Reserved.