/* * px * Copyright (c) 2008 Shawn Hladky Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "pxheaders.h" #include "rollbackcommand.h" #include "RollBack.h" #include "RBFilter.h" ErrorId rollback_usage = { ErrorOf( ES_CLIENT, 0, E_INFO, EV_USAGE, 0 ), "\n" " rollback -- Undo a submitted changelist.\n" "\n" " rollback [ -c pendChange -d -D<flag> ] submittedChange\n" "\n" " 'px rollback' opens all of the files in submittedChange in\n" " the pending changelist pendChange, or the default changelist if\n" " none is specified. Each file that was deleted in submittedChange\n" " will be opened for add in pendChange, each file that was added will\n" " be opened for delete, and each file that was edited will be opened\n" " for edit at the previous revision, with an 'ignore' resolve against\n" " the revision being rolled back.\n" "\n" " By default, revisions that can't be rolled back without implicitly\n" " rolling back later revisions will be skipped. Using the '-d' flag\n" " will force these revisions to be rolled back anyway. The '-D' flag\n" " can be used to allow only some types of implicit rollbacks:\n" " -Di: Deleted files that have been re-added. (open for edit)\n" " -Ds: Edited files that have been deleted. (open for add)\n" " -Dt: Added files that have been edited. (open for delete)\n" "\n"}; void rollbackCommand::Help(Error *e) { e->Set(rollback_usage); } void rollbackCommand::Run(ClientUser* cu, ClientApi* api, char *const *argv, int argc) { //Run a quick "info" to clear the stored argv in ClientApi. //This will return an error (unexpected arg), which we must trap. ClientUser ui; RBFilter dev_null( &ui ); dev_null.SetMode( RBFilter::HideAll ); api->Run( "info", &dev_null ); //Now run the rollback command. RollBack rb( command.Text() ); if (tagged) rb.SetTagged(); rb.Run( api, cu, argc, (char**) argv ); }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#2 | 6362 | Sam Stafford |
Fixed a bug with an extra arg getting passed to rollback's first command and causing a strange "no such file" error at the start of the output. Cheesy workaround is to run an extra throwaway command at the beginning to flush out the ClientApi. Updated "px help" entry while I was in there. |
||
#1 | 6342 | Sam Stafford | Branching px to make a fix. | ||
//guest/shawn_hladky/px/src/commands/rollback/rollbackCommand.cpp | |||||
#1 | 6331 | Shawn Hladky | Integrating rollback into px |