Revert: Undoing Changes
The Revert command implements an "undo change" capability for dynamic streams.
Revert Overview
The Revert command doesn't actually remove any versions from the stream or transactions from the repository; that never occurs, since it would be a violation of AccuRev's TimeSafe principle. Instead, Revert creates a new version of one or more elements in a workspace based on the stream.
Note: There is one exception to this workspace requirement: the Revert Change Package command option to continue without using a workspace, available in the StreamBrowser. (see “Revert Change Package” in The Active Issues Tab (Show Active Issues))
The contents of the new version are the result of "subtracting out" a certain set of changes from the stream's current version:
- the changes that were added to the stream in a specified promote transaction, or
- the changes contained in a change package that is currently in the stream.
The "subtracting out" of content changes is performed by the Merge tool. Submitting a different set of versions to this tool effectively implements the reverse patch algorithm (see Reverse Patch: Removing Content Changes).
After the Revert command completes, you can verify the correctness of its work (and make further changes, if appropriate) in the workspace. Then, you can complete the "undo change to stream" process by promoting the new versions.
Note: Again, the Revert Change Package command available in the StreamBrowser (Revert Change Package) has an option to continue without using a workspace. The results of this revert are placed directly in the stream itself. However, AccuRev recommends that you still build and test these changes in an updated workspace to verify the results.
Invoking the Revert Command
There are several ways to invoke the Revert command:
- Reverting a Transaction. Open a History Browser tab, showing the transactions for the dynamic stream where you want to perform the "undo". To do this, choose View > Streams from the GUI main menu (and, if prompted, choose the depot containing your stream). Right click your stream, and choose Show History from the context menu. Then right-click the transaction to be reverted, and choose Revert from the context menu. Only transactions whose action is promote can be reverted.
- Reverting a Change Package. Open a Stream Issues tab, showing the issues whose change packages are in the dynamic stream where you want to perform the "undo". To do this, choose Show Issues from the context menu of any dynamic stream in the StreamBrowser. Or choose Show Diff by Issues from the context menu of a dynamic stream, then select another stream to compare it with.
Choosing a Workspace for the Revert Command
AccuRev displays the workspaces that both:
Belong to you, and
Are children of the stream whose transaction or change package you wish to revert
The workspace you select will be used to perform a reverse patch operation. AccuRev invokes the Merge tool in a special mode to perform this operation, with the file in the selected workspace as one of the contributors. It refuses to proceed if the file is currently active in the workspace.
Revert to Basis
For each selected element, this command removes all changes you've made since the last time you Promoted it, or since the last Update of the workspace — whichever is more recent:
- File elements: this includes both content changes and namespace changes.
- Directory elements: this includes namespace changes only.
- Link elements: this command operates on the link itself, "undo"ing changes you've made to the specification of the link target. For example, you might have changed the link with the defunct or rename commands. Or you might have used Copy / Paste to point the link at a different target directory.
The selected elements become inactive in the workspace (they are removed from the workspace's default group). The status of the elements becomes (backed).
Tip: When you invoke this command in a dynamic stream, the depot's pre-promote-trig trigger fires. This is because, like a Promote, the command changes which version of the element appears in the stream.
Revert to Most Recent Version
(This command is enabled only in a workspace, and only for file elements with (modified) status. Link and directory elements cannot have (modified) status.)
This command replaces (by invoking the Populate command) each selected file with the most recent version you created with Keep. (This command does not undo any namespace changes you made with Rename or with Cut-and-Paste.) The selected elements remain active in the workspace. That is, they are not removed from the workspace's default group. The (modified) status of the elements changes to (kept).
Use this command when you have saved one or more intermediate versions of the files, and you want to discard further changes you have made since a Keep.
If you have modified a file but not yet performed a Keep on it, this command works like the Revert to Basis.