The Patch From Command

Patch vs. Merge

Invoking the Patch From Command

The Patch Algorithm

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 AccuRev's Merge tool or a third-party text-file-merge tool.)

Patch vs. Merge

When you merge version V of a file into your workspace version, you are saying:

"combine my file with version V, taking into account all the changes in version V, back to the common ancestor"

When you patch version V of a file into your workspace version, you are saying:

"combine my file with version V, taking into account only the recent changes to version V"

To find the "recent changes to Version V", AccuRev scans backward through the file’s ancestry The entire set of versions of an element. See version graph., starting at version V and stopping when it encounters ...

... or ...

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.

In identifying versions "between" the head and basis versions, AccuRev follows both direct ancestor and merge ancestry lines. In particular, if version V was created by a merge, its "recent changes" include both contributors to the merge.

Notes (click to view):

Invoking the Patch From Command

You can invoke Patch From on a selected version in the following contexts:

AccuRev processes the files you specify one-by-one. For each file, it does one or both of the following:

The Patch Algorithm

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.