The Patch From (or
Patch) command performs a
patch operation on a text-file element, incorporating
some of the changes in a specified "patch from" version into the version in your workspace. The combined contents are saved, with
Keep, as a new version in your workspace.
The patch operation is operationally similar to a merge operation, which incorporates
all of the changes in a specified version. (In fact, both operations use the same tool, either AccuRev's
Merge tool or a third-party text-file-merge tool.)
This backward search defines a patch to the element. Version V is termed the head version of the patch. The older version is termed the
basis version of the patch. The patch consists of all the versions of the element between the basis version and head version. The basis version itself is not included in the patch -- it precedes the set of "recent changes" in version V. The head version is included in the patch -- it contains the latest of the recent changes.
Prior to AccuRev 3.5.5, the Patch From command used a simpler definition of "recent changes to Version V" -- it meant "just the changes between version V and its immediate predecessor". (In effect, the
Show Patch List command still uses this definition of patch, showing all the individual versions whose changes need to be propagated between two streams.)
For example, suppose user Mary recently created versions 4, 5, 6, and 7 of a file in her workspace, talon_dvt_mary. When patching version
talon_dvt_mary/7 into your workspace version, AccuRev previously only incorporated the changes between versions
talon_dvt_mary/6 and
talon_dvt_mary/7. The limitation of this simple algorithm is clear: you probably wanted to incorporate all of Mary’s recent changes — the modifications in versions 4, 5, 6, and 7. In previous releases, you would have had to perform four separate
Patch From commands to achieve this result.
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. He invokes the
Patch From command from the context menu of this version. 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.
Mary started a task 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 then 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 7 and 8 — contain "recent changes". The idea is that a promotion typically marks the end of a programming task, not an intermediate checkpoint.
John patches version trike_dvt_mary/3 into his workspace, creating version
trike_mnt_john/1. Because Mary's version was created by a merge, the patch includes the recent changes to both merge contributors.

You can invoke Patch From on a selected version in the following contexts:
·
In the Version Browser (when invoked from a workspace), to patch from an arbitrary version.
·
In the History Browser (when invoked from a workspace), to patch from the version in a particular transaction.
The Patch From command performs its content-level work with the Merge tool. Submitting a different set of versions to this tool effectively implements the patch algorithm (see
The Merge, Patch, and Reverse Patch Algorithms on page 242).