Patch From (or
Patch) perform 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.
Patch creates a new version in a workspace. This version is termed the
head version of the patch. AccuRev automatically determines a corresponding
basis version by scanning backward through the element’s ancestry. The basis version is the most recent version that was either:
When you merge version v of a file into your workspace version, you are saying:
When you patch version v of a file into your workspace version, you are saying:
To find the "recent changes to version v", AccuRev scans backward through the file’s ancestry, starting at version
v and stopping when it encounters ...
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.
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.
Allison patches version trike_dvt_john/4 into her workspace, creating version
trike_dvt_allison/1. Because John'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, a version created by
Patch is connected to the "patch from" version with a
dashed red line. Selecting this version highlights the versions in the patch.
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).