2. AccuRev® Command-Line Reference : patch

patch
incorporate a set of changes from a given workspace into the current version
Usage
accurev patch [ -G ] [ -O ] [ -j <ver-spec> ] -v <ver-spec>
{ <element-list> | [ --from_stream=streamname ] -l <list-file> }
accurev patch [ -G ] [ -O ] [ -I <issue-number> [ -3 ] ]
{ <element-list> | -l <list-file> }
Description
The patch command is a variant of merge:
merge incorporates the entire set of changes between the from version and the common ancestor version.
patch incorporates just the set of “recent changes” in the from version. It determines this set of changes by starting at the from version and scanning backward through the file’s ancestry. The scan stops when it encounters a version that was originally created in another workspace, or a version that was promoted to another stream. This older version, termed the basis version, is judged to precede (and not belong to) the set of “recent changes” in the from version (which is also termed the head version).
You can use the -j option to suppress this automatic determination of the basis version, specifying a particular version to be used as the basis version.
You can specify multiple elements on the command line; each one will be patched as described above.
Basis Version Examples
Example 1: Before Mary started her recent work, she updated her workspace. This brought in a version of the file originally created by another user — say, version brown_dvt_john/5. Then she proceeded to create versions 5 through 7 in workspace brown_dvt_mary.
Derek decides to patch version brown_dvt_mary/7 into his workspace. AccuRev searches backward through the element’s ancestry, and includes the set of changes recently made in Mary’s workspace: this set includes brown_dvt_mary/5 through brown_dvt_mary/7; the patch doesn’t include the two versions created in workspace brown_dvt_john.
Example 2: Suppose Mary started by bringing version brown_dvt_john/6 into her workspace with an update. Then she created versions brown_dvt_mary/4 through brown_dvt_mary/6, promoted her work to the backing stream, and created two more versions: brown_dvt_mary/7 and brown_dvt_mary/8.
When John patches version brown_dvt_mary/8 into his workspace, AccuRev decides that only the versions since the promotion — versions 7and 8— contain “recent changes”. The idea is that a promotion typically marks the end of a programming task, not an intermediate checkpoint.
Indicating a Patch and its Set of Versions
The Version Browser uses a dashed red line to indicate a version created by a Patch command. Selecting the version causes the set of versions included in the patch to be highlighted in red.
The basis version is recorded in the keep transaction that records a Patch command in the repository:
transaction 206; keep; 2005/12/29 15:57:57 ; user: john
# patched
\.\dir00\sub02\file03.txt 5/10 (5/10)
ancestor: (5/9) patched from: (4/8)-(4/6)
In this command, version 4/8 (brown_dvt_mary/8) was patched into version 5/9 (brown_dvt_john/9), and the result was kept as version 5/10 (brown_dvt_john/10). The backward search through the file’s ancestry identified 4/6 (brown_dvt_mary/6) as the basis version.
Options
-G
Use the graphical Merge tool to perform the operation if there are any conflicts (which require human interaction).
-O
When merging each file, use the workspace version’s contents.
-I <issue-number>
Patch the contents of the change package of the specified AccuWork issue record. That is: for each change package entry indicated by an element argument, patch the entry’s head version into your workspace version.
-3
Specifies that the <issue-number> specified by the -I switch is a third-party ITS key rather than an AccuWork issue number.
--from_stream=<stream_name>

Displays output all segments of visible variants of the specified issue in the specified stream. For discussions about segments and variants, see the "Change Packages" chapter of the AccuRev
On-Line Help.
-j <ver-spec>
Specify the basis version. Must be used with -v <ver-spec>.
-l <list-file>
Process the elements listed in <list-file>. This must be a text file, with one element name per line. Extra whitespace is not allowed; make sure there are no empty lines and no leading or trailing white space around the filenames. Wildcards are not expanded. There is no provision for comment lines in the file.
If you use this option, any <element-list> specified is silently ignored.
<element-list>
One or more element names, separated by whitespace. If you also specify a <list-file> using the –l option, this <element-list> is silently ignored.
-v <ver-spec>
Specify the version whose changes are to be incorporated into your workspace’s copy of the element. The corresponding basis version is determined automatically if you do not use the -j option.
 
Examples
Patch in the change that was finished in version 4/3 of foo.c:
> accurev patch -v 4/3 foo.c
Patch in the change that was finished in version 5/19 of foo.c, using version 4/6 as the basis version:
> accurev patch -v 5/19 -j 4/6 foo.c
See Also
anc, diff, merge, mergelist, patchlist
Using a Specific Version of an Element on page 14

Borland