3. AccuWork™ Command-Line Interface : AccuWork CLI Operations

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.
Display history in terms of change packages (<cpkhist> document) — List transactions and the change packages that they modified.
Report issue relationships (<listRelatedIssues> document) — List records that are related, through the Duplicate relationship, to a particular issue record.
The sections below provide guidelines for performing each of these operations. But there’s an important prerequisite step to perform first.
Determining the Field-ID / Field-Name Correspondence
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-inst-dir>/storage/depots/<depot-name>/dispatch/config/schema.xml
You can retrieve the contents of the schema.xml file from an AccuRev client machine with this command:
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:
name="issueNum"
fid="1">
name="transNum"
fid="2">
name="status"
fid="3">
name="shortDescription"
fid="4">
name="state"
fid="5">
name="productType"
fid="6">
name="type"
fid="7">
name="severity"
fid="8">
name="priority"
fid="9">
name="submittedBy"
fid="10">
name="dateSubmitted"
fid="11">
name="platform"
fid="12">
...
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 document 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 below.

Borland