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.
An attribute is a name/value pair:
BugNum / 455 | Integer-valued attribute |
BenchMark / 12.9 | Real-valued attribute |
ProjectID / "orange" | String-valued attribute |
DueOn / 5-Jan | Date-value attribute |
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:
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.
You must have one of the following identities:
An error occurs if one or more of these objects are locked: VOB, element type, element, branch type, branch, attribute type, object to which the attribute is being attached (for non-file-system objects).
(Replicated VOBs only) If the attribute's type is unshared, your current replica must master the type. If the attribute's type is shared, your current replica must master the object to which you are applying the attribute. If the attribute's type is global and shared, your current replica must master the object to which you are applying the attribute; also, your current replica must contain a local copy of the type, or the administrative VOB at the current site must master the type.
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.
Examples:
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 |
Use –version to override these interpretations of pname.
Note: mkattr differs from some other commands in its default handling of directory element pname arguments: it assigns an attribute to the directory element itself; it does not assign attributes to the elements cataloged in the directory.
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 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.
UNIX:
Windows:
UNIX:
cmd-context mkattr –replace TESTED '"FALSE"' hello.h
Created attribute "TESTED" on "hello.h@@/main/2".
Windows:
UNIX:
Windows:
cmd-context mkattr RESPONSIBLE \"Anne\" hello.c@@
Created attribute "RESPONSIBLE" on "hello.c@@".
UNIX:
cmd-context mkattr TESTED '"NOT TRUE"' foo.c
Created attribute "TESTED" on "foo.c@@/main/CHECKEDOUT"
Windows:
The same command in cleartool single-command mode shows the difference in quoting.
Copyright© 2003 Rational Software. All Rights Reserved.