The mkattr command attaches an attribute to one or more objects. You can specify the objects themselves on the command line, or you can specify a particular derived object. In the latter case, mkattr attaches attributes to versions only—some or all of the versions that were used to build that derived object.
In several situations, attempting to attach a new attribute causes a collision with an existing attribute:
A collision causes mkattr to fail and report an error, unless you use the –replace option, which first removes the existing attribute.
The find command can locate objects by their attributes. Examples:
cmd-context find . –element 'attype_sub(BugNum)' –print
Now do the same thing on a Windows system; note the difference in quoting.
More generally, queries written in the query language can access objects using attribute types and attribute values. See the query_language reference page for details.
The options and arguments in this section specify objects to be assigned attributes directly on the command line. Do not use these options and arguments when using a derived object to provide a list of versions to be assigned attributes.
foo.c |
Version of foo.c selected by current view) |
/view/gamma/usr/project/src/foo.c |
Version of foo.c selected by another view |
foo.c@@\main\5 |
Version 5 on main branch of foo.c) |
foo.c@@/REL3 |
Version of foo.c with version label 'REL3') |
foo.c@@ |
The element foo.c |
foo.c@@\main |
The main branch of element foo.c |
The options and arguments in this section specify versions to be assigned attributes by selecting them from the configuration records associated with a particular derived object. Do not use these options when specifying objects to be assigned attributes directly on the command line.
With the exception of checked-out versions, mkattr attaches attributes to all the versions that would be included in a catcr –flat listing of that derived object. Note that this includes any DO created by the build and subsequently checked in as a DO version.
If the DO's configuration includes multiple versions of the same element, the attribute is attached only to the most recent version.
Use the following options to modify the list of versions to which attributes are attached.
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 mkattype –nc –vtype integer BugNum
Created attribute type "BugNum".
cmd-context mkattr BugNum 21 util.c
Created attribute "BugNum" on "util.c@@/main/maintenance/3".
cmd-context mkattr TESTED '"TRUE"' hello.h
Created attribute "TESTED" on "hello.h@@/main/2".
cmd-context mkattr TESTED \"TRUE\" hello.h
Created attribute "TESTED" on "hello.h@@\main\2".
cmd-context mkattr –replace TESTED '"FALSE"' hello.h
Created attribute "TESTED" on "hello.h@@/main/2".
cmd-context mkattr –replace TESTED \"FALSE\" hello.h
Created attribute "TESTED" on "hello.h@@\main\2".
cmd-context mkattr RESPONSIBLE '"Anne"' hello.c@@
Created attribute "RESPONSIBLE" on "hello.c@@".
cmd-context mkattr RESPONSIBLE \"Anne\" hello.c@@
Created attribute "RESPONSIBLE" on "hello.c@@".
cmd-context mkattr TESTED_BY \"$USER\" util.c
Created attribute "TESTED_BY" on "util.c@@/main/5".
cmd-context mkattr TESTED_BY \"%USERNAME%\" util.c
Created attribute "TESTED_BY" on "util.c@@\main\5".
cmd-context mkattr TESTED '"NOT TRUE"' foo.c
Created attribute "TESTED" on "foo.c@@/main/CHECKEDOUT"
cmd-context mkattr TESTED "\"NOT TRUE\"" foo.c
Created attribute "TESTED" on "foo.c@@\main\CHECKEDOUT".
cleartool> mkattr OWNER '"jpm"' bar.cCreated attribute "OWNER" on bar.c
The same command in cleartool single-command mode shows the difference in quoting.
cleartool mkattr OWNER \"jpm\" bar.cCreated attribute "OWNER" on bar.c
cmd-context mkattr –config hello.obj -default TESTED
Created attribute "TESTED" on "\usr\hw\@@\main\1".
Created attribute "TESTED" on "\usr\hw\src@@\main\2".
Created attribute "TESTED" on "\usr\hw\src\hello.c@@\main\3".
Created attribute "TESTED" on "\usr\hw\src\hello.h@@\main\1".
cmd-context mkattr –config 'hello' –name '*.c' TESTED '"FALSE"'
Created attribute "TESTED" on "/usr/hw/src/hello.c@@/main/3".
Created attribute "TESTED" on "/usr/hw/src/util.c@@/main/1".
cmd-context mkattr –config hello.exe –name '*.c' TESTED \"FALSE\"
Created attribute "TESTED" on "\usr\hw\src\hello.c@@\main\3".
Created attribute "TESTED" on "\usr\hw\src\util.c@@\main\1".
cmd-context mkattr –config hello.exe –name '\src\lib\...' TESTED \"TRUE\"
Created attribute "TESTED" on "\src\lib\hello.c@@\main\8".
Created attribute "TESTED" on "\src\lib\util.c@@\main\5".
Created attribute "TESTED" on "\src\lib\hello.h@@\main\1".
% cleartool
cleartool> mkattr –config hello –name '/src/lib/...' TESTED '"TRUE"'
Created attribute "TESTED" on "/src/lib/hello.c@@/main/8".
Created attribute "TESTED" on "/src/lib/util.c@@/main/5".
Created attribute "TESTED" on "/src/lib/hello.h@@/main/1".