File Purge (Revert to Basis)
Scenario
You fix an issue and then promote the affected files from your workspace to an integration stream. For some reason, someone decides to perform a purge (Revert to Basis) on one of the files. When it's time to promote the change package from the integration stream to its parent stream, you discover that the change package is incomplete and the Promote icon is grayed out. This is, in fact, exactly what happened in An Example Scenario above.
You can tell that this is the case by right-clicking on the “missing” file (file_002.c) and selecting Browse Versions.
The second, disconnected box for version 2 is the tip-off that the file was purged, and the tooltip message confirms the action.
How do you fix it?:
If you determine that the purge was a good idea, and that the change package doesn't require the purged file, your simplest fix is to remove it: go to the Changes tab for the issue, select the file and then click Remove. Once you have done this, the issue will no longer appear when Include Incomplete Issues is checked, and you will be able to promote the change package further up the stream hierarchy.
However, if it turns out that the purge was a mistake, you'll need to reverse it. Because AccuRev is TimeSafe, you can’t just make the purge disappear like it never happened. But what you can do is send that version of the file to your workspace (right-click the version in the Version Browser and select Send To Workspace and re-promote it. When the file becomes active in your workspace, it will not have the same version number—in this example it will now be version “3” instead of the original version “2”, and will become version “4” when you perform a Keep on it. After you promote it, the change package in the parent stream will again be complete, and the version browser will no longer show the purged version as a disconnected box.
How do you prevent this from happening in the future?:
If you need to purge a file, first make sure that it is not part of a change package. Pay attention to any error message that tries to warn you against making a mistake.
You typically want to click No in response to such a warning.
If the file is a part of a change package, and you still want to purge the file, then perform a Revert by Change Package instead: in the Stream Browser, right-click the stream from which you wish to revert the change package and click Show History. Then select the promotion operation you wish to reverse, and click the Revert icon (). Make the adjustments you need in your workspace, and then re-promote the modified change package.
Note: As of AccuRev Release 5.2, you now have two ways to Revert by Change Package:
Revert Change Package Using Workspace
Revert Change Package Directly in Stream
Revert Change Package Using Workspace gives you the opportunity to test your changes before promoting them into a stream. Revert Change Package Directly in Stream puts the results of the revert into the stream immediately, so should be used for simpler reverts, or in streams that do not propagate untested changes to other users.
You can also prevent non-administrators from purging files in streams by customizing the server_preop_trig trigger. See see How to Troubleshoot Incomplete Change Packages for more information.