Attaches attributes to objects
Product | Command Type |
---|---|
ClearCase | cleartool subcommand |
ClearCase LT | cleartool subcommand |
Attache | command |
Platform |
---|
UNIX |
Windows |
Attach attributes to specified file-system objects:
Attach attributes to specified non-file-system objects:
Attach attributes to versions listed in configuration record:
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 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:
You want to change the value of an existing attribute on an object.
(If the attribute type was created with mkattype -vpbranch) An attribute is attached to a version, and you want to attach an attribute of the same type to another version on the same branch.
(If the attribute type was created with mkattype -vpelement) An attribute is attached to a version, and you want to attach an attribute of the same type to any other version of the element.
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:
On a UNIX system, list all elements in the current working directory for which some version has been assigned a BugNum attribute.
cmd-context find . -element 'attype_sub(BugNum)' -print
Now do the same thing on a Windows system; note the difference in quoting.
cmd-context find . -element attype_sub(BugNum) -print
List the version of element util.c to which the attribute BugNum has been assigned with the value 4059
(note UNIX quoting).
cmd-context find util.c -version 'BugNum==4059 ' -print
On a Windows system, list the version of all elements in the current working directory to which the attribute Tested has been assigned with the string value "TRUE"
.
cmd-context find . -version 'Tested=="TRUE"' -print
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.
Identities: You must have one of the following identities:
Element owner
Element group member
Object owner
Object group member
VOB owner
root (UNIX)
Member of the ClearCase group (ClearCase on Windows)
Local administrator of the ClearCase LT server host (ClearCase LT on Windows)
Locks: 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).
Mastership: (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.
MOVING AN ATTRIBUTE OR CHANGING ITS VALUE. Default: An error occurs if an attribute collision occurs (see Restrictions on Attribute Use).
SPECIFYING THE ATTRIBUTE TYPE AND VALUE. Default: None. You must specify an existing attribute type; you must also indicate a value, either directly or with the -default option.
type-name | Name of the attribute type | |
vob-selector | Object-selector for a VOB, in the form [vob:]pname-in-vob. The pname-in-vob can be the pathname of the VOB-tag (whether or not the VOB is mounted) or of any files-ystem object within the VOB (if the VOB is mounted) |
Value Type | Input Format | ||
integer | Any integer that can be parsed by the Windows strtol or UNIX strtol(2) system calls | ||
real | Any real number that can be parsed by the Windows strtod or UNIX strtod(2) system calls | ||
date | A date-time string in one of the following formats: | ||
date.time | date | time | now | |||
date | := | day-of-week | long-date | |
time | := | h[h]:m[m][:s[s]] [UTC [ [ + | - ]h[h][:m[m] ] ] ] | |
day-of-week | := | today | yesterday | Sunday |...| Saturday | Sun |...| Sat | |
long-date | := | d[d]-month[-[yy]yy] | |
month | := | January |... |December |Jan |... |Dec | |
Specify time in 24-hour format, relative to the local time zone. If you omit the time, the default value is 00:00:00. If you omit date, the default is today. If you omit the century, year, or a specific date, the most recent one is used. Specify UTC if you want to resolve the time to the same moment in time regardless of time zone. Use the plus (+) or minus (-) operator to specify a positive or negative offset to the UTC time. If you specify UTC without hour or minute offsets,Greenwich Mean Time (GMT) is used. (Dates before January 1, 1970 UTC are invalid.) | |||
string | Any string in standard C-language string literal format. It can include escape sequences: \n, \t, and so on. UNIX SYSTEMS NOTE: The string must be enclosed in double quotes. Also note that the double-quote (") character is special to both the cleartool command processor and the UNIX shells. Thus, you must escape or quote this character on the command line. These two commands are equivalent: cleartool mkattr QAed '"TRUE"' hello.c WINDOWS SYSTEMS NOTE: The Windows shell removes double quotes, so to pass them through to the cleartool command processor, you must precede them with a backslash character on the command line: c:\> cleartool mkattr QAed \"TRUE\" hello.c | ||
opaque | A word consisting of an even number of hexadecimal digits (for example, |
DIRECTLY SPECIFYING THE OBJECTS. 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.
vob-selector | vob:pname-in-vob | |
pname-in-vob can be the pathname of the VOB-tag (whether or not the VOB is mounted) or of any file-system object within the VOB (if the VOB is mounted). It cannot be the pathname of the VOB storage directory. | ||
attribute-type-selector | attype:type-name[@vob-selector] | |
branch-type-selector | brtype:type-name[@vob-selector] | |
element-type-selector | eltype:type-name[@vob-selector] | |
hyperlink-type-selector | hltype:type-name[@vob-selector] | |
label-type-selector | lbtype:type-name[@vob-selector] | |
trigger-type-selector | trtype:type-name[@vob-selector] | |
pool-selector | pool:pool-name[@vob-selector] | |
hlink-selector | hlink:hlink-id[@vob-selector] | |
oid-obj-selector | oid:object-oid[@vob-selector] | |
The following object selector is valid only if you use MultiSite: | ||
replica-selector | replica:replica-name[@vob-selector] |
EVENT RECORDS AND COMMENTS. Default: Creates one or more event records, with commenting controlled by your .clearcase_profile file (default: -nc). See the comments reference page. Comments can be edited with chevent.
USING A DERIVED OBJECT TO SPECIFY VERSIONS. 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.
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. In Attache, cmd-context represents the workspace prompt.
Create an attribute type named BugNum. Then, attach that attribute with the value 21 to the version of util.c that fixes bug 21.
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".
On a UNIX system, attach a TESTED attribute to the version of hello.h in the view, assigning it the value "TRUE"
.
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".
Update the value of the TESTED attribute on hello.h to "FALSE"
. This example shows that to overwrite an existing attribute value, you must use the -replace option.
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".
Attach a RESPONSIBLE attribute to the element (not a particular version) hello.c.
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@@".
On a UNIX system, attach a TESTED_BY attribute to the version of util.c in the view, assigning it the value of the USER environment variable as a double-quoted string. Using \" causes the shell to pass through (to cleartool) the double-quote character instead of interpreting it. (Specifying the attribute value as '"$USER"'
does not work, because the single quotes suppress environment variable substitution.)
cmd-context mkattr TESTED_BY \"$USER\" util.c
Created attribute "TESTED_BY" on "util.c@@/main/5".
On a Windows system, Attach a TESTED_BY attribute to the version of util.c in the view, assigning it the value of the USERNAME environment variable.
cmd-context mkattr TESTED_BY \"%USERNAME%\" util.c
Created attribute "TESTED_BY" on "util.c@@\main\5".
Attach a TESTED attribute to the version of foo.c in the current view, specifying an attribute string value that includes a space.
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"
.
On a Windows system in cleartool interactive mode, attach an OWNER attribute to the version of bar.c in the current view.
cleartool>
mkattr OWNER '"jpm"' bar.c
Created attribute "OWNER" on bar.c
The same command in cleartool single-command mode shows the difference in quoting.
cleartool mkattr OWNER \"jpm\" bar.c
Created attribute "OWNER" on bar.c
Attach a TESTED attribute with the default value to each version that was used to build derived object hello.obj. Note that the attribute is assigned to versions of both files and directories.
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".
On a UNIX system, attach a TESTED attribute with the value "FALSE"
to those versions that were used to build hello, and whose pathnames match the *.c tail pattern.
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".
On a Windows system, attach a TESTED attribute with the value "FALSE"
to those versions that were used to build hello.exe, and whose pathnames match the *.c tail pattern.
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".
On a Windows system, attach a TESTED attribute with the value "TRUE"
to all versions in the VOB mounted at \src\lib that were used to build hello.exe.
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".
On a UNIX system, attach a TESTED attribute with the value "TRUE"
to all versions in the VOB mounted at /src/lib that were used to build hello. Use interactive mode to enable use of the "..." wildcard.
% 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".
describe, mkattype, query_language, rmattr
Feedback on the documentation in this site? We welcome any comments!
Copyright © 2001 by Rational Software Corporation. All rights reserved. |