Many ClearCase commands read information from a VOB database, format the data, and send it to standard output. (In most cases, the information is stored in event records, written by the command when it creates or modifies an object in a VOB. See the events_ccase reference page.) Some of these commands have a –fmt option, which you can use to format simple reports on VOB contents. Note that –fmt is a mutually exclusive alternative to the –short and –long options.
The following example shows how output-formatting options affect an lshistory command.
cmd-context lshistory -since 1-Feb util.c–02-10T11:21 anne create version
"util.c@@/main/rel2_bugfix/1"
"fix bug: extra NL in time string"
–02-10T11:21 anne create version "util.c@@/main/rel2_bugfix/0"
–02-10T11:21 anne create branch "util.c@@/main/rel2_bugfix"
cmd-context lshistory -short -since 1-Feb util.cutil.c@@/main/rel2_bugfix/1
util.c@@/main/rel2_bugfix/0
util.c@@/main/rel2_bugfix
cmd-context lshistory -fmt "\tElement: %-13.13En Version: %Vn\n" -since
1-Feb util.c
Element: util.c Version: /main/rel2_bugfix/1
Element: util.c Version: /main/rel2_bugfix/0
Element: util.c Version: /main/rel2_bugfix
(A \t escape sequence tabs output to the next tab stop. Tab stops occur at eight-character intervals, except as described in the annotate reference page.)
A conversion specification identifies a particular data item to display and specifies its display format.
The conversion specification format closely resembles that of the C-language function printf():
Unlike printf() specifiers, conversion specifications are not replaced by arguments supplied elsewhere on the command line; they are replaced automatically by cleartool, usually with field values extracted from event records.
These are the conversion specifications:
create version
create branch
make hyperlink "Merge" on version
make label "REL2" on version
lock branch type
For a VOB replica, %h displays the name of the host at which the mkreplica –export command that created the replica was entered. For the original replica in a family, this is the host where the original VOB was located when the first mkreplica –export command was entered.
Max labels: Specify the maximum number of labels to display with the max-field-width parameter (see Specifying field width). If there are more labels, "..." is appended to the output. If no max-field-width is specified, the maximum default value is 3. |
|
No commas: Suppress the parentheses and commas in label list output; separate labels with spaces only. |
mkelem
mklabel
checkin
checkout
See the events_ccase reference page for a complete list of operations and the commands that cause them.
The variants in Table 2 apply only to UCM objects.
The variants in Table 3 apply only to objects in replicated VOBs (ClearCase MultiSite product).
A conversion specification can include an optional field width specifier, which assigns a minimum and/or maximum width, in characters, to the data field display. For example, the conversion specifier %10.15Lu will display, for each output line, the user's login name and group with a minimum of 10 characters (space padded if necessary) but not more than 15.
The UNIX system and Linux 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 system and Linux shells or Windows command interpreter prompt, followed by the cleartool command. In cleartool interactive mode, cmd-context represents the interactive cleartool prompt.
cmd-context lsco -cview -fmt "\t%-10.10n (from %8.8PVn) %d %u\n"
util.c (from /main/23) 2007-02-18T14:12:48 anne
main.c (from /main/46) 2007-02-18T18:42:33 anne
msg.c (from /bugfix/11) 2007-02-19T10:45:13 anne
msg.h (from /bugfix/3) 2007-02-19T14:51:55 anne
cmd-context lshistory -fmt "OBJ-NAME: %-20.20n\n USER: %-8.8u\n DATE: %d\\n OPERATION:\t%-12.12o\n OBJ-TYPE:\t%-15.15m\n EVENT:\t%e\n COMMENT: %c\n" util.c OBJ-NAME: util.c@@/main/3 USER: anne DATE: 2007-05-10T09:24:38 OPERATION: checkin OBJ-TYPE: version EVENT: create version COMMENT: fix bug r2-307 OBJ-NAME: util.c@@/main/2 USER: anne DATE: 2007-05-10T09:09:29 OPERATION: checkin OBJ-TYPE: version EVENT: create version COMMENT: ready for code review
cmd-context describe -fmt "\tVer:\t%f\n\tPrefix:\t%[MY TEXT]%f\n\t
Status:\t%Rf\n\tView:\t%Tf\n" util.c
Ver: /main/23
Prefix: MY TEXT/main/23
Status: reserved
View: eba_view
cmd-context describe -fmt "Type: %[type]p\n" util.c@@Type: text_file
cmd-context describe –fmt "%n\t%[slink_text]p\t%[slink_text]Tp\n"
link1.txt
link1.txt file.txt ..\dev\file.txt
cmd-context lstype –fmt "Label type: %n\tMaster: %[master]p\n" –kind
lbtype
Label type: BACKSTOP Master: evanston@/vobs/tromba
Label type: CHECKEDOUT Master: evanston@/vobs/tromba
Label type: LATEST Master: evanston@/vobs/tromba
Label type: V3.4 Master: paris@/vobs/tromba
cmd-context describe -fmt
"%[4]tName:%[6]t%[name]p\n
%[4]tName:%[6]Nt%[name]p\n
%[4]tName:%[6]St%[name]p\n
%[4]tName:%[6]Tt%[name]p\n" util.c Name:util.c@@\main\30
Name:
util.c@@\main\30
Name: util.c@@\main\30
Name: util.c@@\main\30
cleartool lshistory -fmt '%d %Fu (%u@%h)\n %e "%n"\n "%Nc"\n' util.c 2007-05-11T09:24:38 Anne Duvo (anne@neptune) create version "util.c@@/main/3" "fix bug r2-307" 2007-05-10T09:09:29 Ravi Singha (ravi@mercury) create version "util.c@@/main/2" "ready for code review" . . .
cleartool lshistory -fmt "%d %Fu (%u@%h)\n %e \"%n\"\n \"%Nc\"\n" util.c 2007-05-11T09:24:38 Anne Duvo (anne@neptune) create version "util.c@@\main\3" "fix bug r2-307" 2007-05-10T09:09:29 Ravi Singha (ravi@mercury) create version "util.c@@\main\2" "ready for code review" . . .
cmd-context describe -fmt "Name (default): %n\n
Element name: %En\n
Leaf name: %Ln\n
Short name: %Sn\n
Predecessor short name: %PSn\n
Version ID: %Vn\n
Predecessor version ID: %PVn\n
Extended name: %Xn\n
Attributes: %a\n
Attr values only: %Sa\n
Attrs without commas or parens: %Na\n
This attr only: %[Tested]a\n
Comment: %c
Date/Time: \tdefault: %d\n
\t\tshort: %Sd\n
\t\tlong: %Vd\n
Age in days: %Ad\n
Age in months: %MAd\n
Age graph (long = new): %BAd\n
Age graph (long = old): %OAd\n
Host: %h\n
Labels: %Cl\n
Labels without commas or parens: %Nl\n
Object kind: %m\n
Operation kind: %o\n
Event kind: %e\n
User (default): %u\n
Full user name: %Fu\n
Group name: %Gu\n
Long name: %Lu\n\n" main.c
Name (default): main.c@@/main/34
Element name: main.c
Leaf name: 34
Short name: /main/34
Predecessor short name: /main/33
Version ID: /main/34
Predecessor version ID: /main/33
Extended name: main.c@@/main/34
Attributes: (Tested="yes", QAlevel=4, Responsible="anne")
Attr values only: ("yes", 4, "anne")
Attrs without commas or parens: Tested="yes"
QAlevel=4 Responsible="anne"
This attr only: (Tested="yes")
Comment: still needs QA
Date/Time: default: 2007-07-30T15:02:49
short: 2007-07-30
long: Tuesday 2007-07-30T15:02:49
Age in days: 42
Age in months: 1
Age graph (long = new): ####
Age graph (long = old): ##
Host: neptune
Labels: (Rel3.1C, Rel3.1D, Rel3.1E)
Labels without commas or parens: Rel3.1C Rel3.1D Rel3.1E
Object kind: version
Operation kind: checkin
Event kind: create version
User (default): anne
Full user name: Anne Duvo
Group name: dev
Long name: anne.dev