cpkdepend

list the dependencies of a change package

Usage

accurev cpkdepend -s <from-stream> [ -S <to-stream> ] [ -fv ]
[ -I <”issue_number1 issue_number2...”> ] [-3] ] [ -p <depot-name> ] [ -fx ]

Description

The cpkdepend command lists the issue records on which the specified issue record(s) depend. It can also produce a dependency listing for an entire depot.

Terminology notes:

  • For the purposes of this command, “issue record N” is shorthand for “change package of issue record N”.
  • If issue record A “depends on” issue record B, we say that B “is a dependency of” A.

Change Package Dependencies

The concept of a change package depending on another change package (or an issue record depending on another issue record) is complex, utilizing several aspects of AccuRev’s product architecture. But the basic idea is familiar: when you ask for something, you sometimes get more than you asked for.

This screen shot from the Version Browser in the AccuRev GUI shows a simple example (screenshot not available from the CLI help):

 

At this point, issue record #13 is active in stream brass_dvt. Promoting that issue record (using promote -Fx -l) promotes version brass_dvt/6 (real version: brass_dvt_phil/25).

Promoting issue record #13 would give you “more than you asked for”: it would automatically promote issue records #2 and #4, as well. We describe this situation by saying that issue record #13 depends on issue records #2 and #4.

Note: In practice, most issue records’ change packages contain entries for multiple elements, not a single element. In many cases, the promotion causes issue records #2 and #4 to be “partially in” the destination stream, not “completely in”.

The discussion above is conceptual and informal. Here’s a rigorous definition of change package dependency:

Issue A depends on issue B, in the context of a promotion from stream S1 to stream S2, if issue A is active in stream S1 and at least one element meets all the following conditions:

  • The element has a change package entry in both issue A and issue B.

  • The head version of the element’s entry in issue A is a descendant of the head version in issue B. (That is, the A version contains the changes made in the B version.)

  • Stream S2’s version of the element is not either the head version of the element’s entry in issue B or a descendant of it. (That is, the changes made in the B version have not yet been promoted to stream S2.)

The Change Package Dependency Hierarchy

For each issue record, there is a dependency hierarchy: the issue directly depends on several issues; each of those issues directly depends on several issues; and so on. cpkdepend does not display dependencies hierarchically, though. (The AccuRev GUI does.) Instead, it displays one or more lists:

If you omit the -fv option, cpkdepend displays a single list: the set of issue records that are direct or indirect dependencies of the issue(s) specified with -I:

> accurev cpkdepend -I 9 -s brass_dvt
Issue                Depends On
9                    7, 1, 3, 2

> accurev cpkdepend -I 5,9 -s brass_dvt
Issue                Depends On
5, 9                 1, 3, 2, 4, 7

If you include the -fv option, cpkdepend displays a list of the direct dependencies for each issue record in the dependency hierarchy of the issue(s) specified with -I:

> accurev cpkdepend -I 9 -s brass_dvt -fv
Issue                Depends On
9                    7, 2
2                    1
7                    1, 3, 2
1                    3
3                    1, 2

If you include the -fv option but omit the -I option, cpkdepend lists all the issue records in the depot that have dependencies. For each such issue record, its set of direct and indirect dependencies is included:

> accurev cpkdepend -s brass_dvt -fv
Issue                Depends On
1                    3, 2
2                    1, 3
3                    1, 2
4                    1, 3, 2
7                    1, 3, 2
8                    2, 1, 3
9                    7, 1, 3, 2
12                   11, 10, 4, 1, 3, 2

Note: cpkdepend can report that A depends on B and B depends on A. This indicates that both issue records have change package entries with the same head version for one or more elements.

The change package dependency hierarchy of an issue record can be quite substantial. Even if just one or two elements cause an issue record (A) to depend on just a few other issue records (B,C,D,...), it might be that other elements in the dependent issue records (B,C,D,...) produce a large number of further dependencies.

Handling a Change Package Dependency

Suppose that executing cpkdepend reveals that dependencies exist in a particular promotion situation — say, issue record #8 depends on issue records #1, #2, and #3. You can handle this situation by propagating less data to the destination stream, or by propagating more data:

“Go for less” alternative: instead of promoting issue record #8, use the patch command on one or more elements in its change package, in order to include the changes made for issue record #9, but excluded the changes made for issue records #1, #2, and #3.

“Go for more” alternative: promote issue record #8, and also promote all of its dependencies: issue records #1, #2, and #3. This ensures that the destination stream gets a “matched set” of source versions.

Options

-s <from-stream>

The promote-from stream. You must specify this option.

-S <to-stream>

The promote-to stream. Default: the parent stream of the stream specified with -s.

 

-I <issue_number1 issue_number2...>

The issue record(s) whose change package dependencies are to be listed. Multiple issues can be specified in a space- or comma-delimited list within quotes.

-3

Specifies that the <issue-number(s)> specified by the -I switch are third-party ITS keys rather than AccuWork issue numbers.

-p <depot-name>

The depot containing the issues. Default: the depot of the current workspace.

-fv

(“verbose”) For each issue record in the dependency hierarchy(s) of the issue record(s) specified with -I, display a list of its direct dependencies. Default: display a single list, showing the direct and indirect dependencies of the issue record(s) specified with -I.

If you omit -I, display a list of the direct and indirect dependencies of the each issue record that has dependencies in the specified stream context.

-fx

Display the results in XML format.

Examples

Display the direct and indirect dependencies of issue records #1004 and #1443, in the context of promotion from stream widget_dvt to its parent stream.

accurev cpkdepend -I 1004,1443 -s widget_dvt

Display the direct dependencies each issue record in the dependency hierarchy of issue record #1004, in the context of promotion from stream widget_dvt to stream widget_mnt.

accurev cpkdepend -fv -I 1004 -s widget_dvt -S widget_mnt

See Also

cpkadd, cpkdescribe, cpkremove, issuediff, issuelist, patch