{{ Project | Rollback | curator=Sam Stafford | path=//guest/sam_stafford/rollback/ | download=//guest/sam_stafford/rollback/bin.ntx86/rollback.exe | license=PPL | language=C/C++ }} [[Category:Perforce]] === About this project === Rollback is a [http://www.perforce.com/perforce/loadsupp.html#api P4API] implementation of [[p4rollback.pl]]. It offers the following advantages over the Perl implementation: * It runs on a single connection and is therefore much faster. * It can be integrated very easily into other apps that use P4API. (See [[px]] for an example.) === Command line usage === Usage: rollback [ -c pendChange -d -D ] submittedChange If provided, the files will be opened in the existing numbered pending changelist '''pendChange'''. '''submittedChange''' is the changelist to roll back. By default, any given file revision will not be rolled back if rolling back that revision would implicitly roll back other revisions. For example, rolling back an edit of a file that has subsequently been deleted would roll back not only the edit but the delete (re-adding the file). The '''-d/-Di/-Ds/-Dt''' flags override this behavior, with each '''-Dx''' flag overriding a specific case and '''-d''' overriding them all: ====-d/-Di==== With this option, rolling back a delete of a file that was subsequently re-added will open it for edit at the revision prior to the delete, requiring a resolve against the re-added revision(s). ====-d/-Ds==== With this option, rolling back an edit of a file that was subsequently deleted will open it for add at the revision prior to the edit, implicitly rolling back the delete. ====-d/-Dt==== With this option, rolling back an add of a file that was subsequently edited will open it for delete, implicitly rolling back the edits. === API usage === The "rollback" command can be executed in a P4API application almost exactly as if it were a normal server-side command by instantiating a RollBack object (declared in {{DepotBrief|//guest/sam_stafford/rollback/RollBack.h}}) and calling the following function: void RollBack::Run( ClientApi* c, ClientUser* ui, int argc, char** argv ); This function call behaves very much like a call to ClientApi::Run(). It requires that the supplied ClientApi object passed in have an initialized connection (as before a normal Run()), and all of the output from the command will be passed back through the supplied ClientUser. If the "tag" protocol is enabled on the ClientApi, output will be passed back in tagged form via OutputStat() as with most server commands. Note that the command arguments are passed in via RollBack::Run() rather than being passed beforehand via ClientApi::SetArgv() as with real server commands; this is because arguments set with SetArgv() are not readily accessible on the client. {{RecentChanges|//guest/sam_stafford/rollback/}} {{License|PPL|2008|Sam Stafford}} {{Sam Stafford}}