AccuWork CLI Operations
You can perform the following AccuWork operations through the command-line interface.
Query issues in a depot (
<queryIssue>document) — Retrieve the contents of all issue records in a particular depot that match a specified query.
Create a new issue record (
<newIssue>document) — Enter a single new issue record in a particular depot.
Modify an existing issue record (
<modifyIssue>document) — Change the contents of a single issue record that already exists in a particular depot.
Add or modify an entry in an issue record’s change package (
Remove an entry from an issue record’s change package (
List the entries in an issue record’s change package (
Display history in terms of change packages (
<cpkhist>document) — List transactions and the change packages that they modified.
Create or remove a Duplicate relationship between two issue records (
Report issue relationships (
<listRelatedIssues>document) — List records that are related, through the Duplicate relationship, to a particular issue record.
Compare the change packages in two streams, snapshots, or workspaces (
Display the issues whose change packages are in a particular stream, snapshot, or workspace (
Before performing any of these operations, be sure you have first determined the correspondence of Field-ID and Field-Name.
In the AccuWork CLI, you identify a field by its field-ID, not by its field-name. Thus, before doing any real AccuWork CLI work, you must determine the correspondence between field-IDs and field-names for issues in your depot. This information is stored in the schema configuration file on the AccuRev Server host:
accurev getconfig -p <depot-name> -r schema.xml
Extract the name= and fid= text lines from this data, and store them for future reference. You’ll need to refer to this information often as you work with the AccuWork CLI. Let’s call this extracted data the field-ID definitions.
For example, the field-ID definitions for the default schema look like this:
This data shows that field submittedBy has field-ID 10, field productType has field-ID 6, etc.
Note: All examples in the remainder of this guide will use the field-ID/field-name correspondence in the above example.
The contents of these XML elements are the field values for issue record #1. A couple of them, submittedBy and dateSubmitted, have values that might be a bit surprising — numbers instead of strings. We’ll discuss these kinds of values in section Selecting Issue Records with a Query.
AccuWork CLI Activation
The AccuWork CLI is implemented through a single command, accurev xml.
accurev xml -l mycmd.xml (“dash-ell” not “dash-one”)
Here, the xml command’s input comes from a file, mycmd.xml, which must contain an XML document. (The filename is irrelevant, and need not have a .xml suffix.) The XML document might contain this specification of an AccuWork query:
21 == "rel2.0"
This example specifies the command, “find all issue records in depot UserReportedBugs whose value in field #21 (the targetRelease field) is the string rel2.0”. The results of an xml command are sent to standard output, also in the form of an XML document. For example, this query might retrieve two issue records, producing this output:
... additional fields ...
... additional fields ...
This output provides the correspondence between field-ID numbers (e.g.
fid="21") and field-names (e.g.
targetRelease). This correspondence is important, since you must specify a query using field-IDs, not field-names (e.g.
21 == "rel2.0", not
targetRelease == "rel2.0").