#include <clientapi.h>
#include "RBUserFiles.h"
#include "RollBack.h"
#include "RBFile.h"
RBUserFiles::RBUserFiles( RollBack* rb )
:rollBack( rb )
{
}
RBUserFiles::~RBUserFiles(void)
{
}
void RBUserFiles::HandleError( Error *err )
{
rollBack->HandleError( err );
}
void RBUserFiles::OutputInfo( char level, const char *data )
{
StrBuf path;
while ( *data && *data != '#' )
{
path.Append( data++, 1 );
}
if ( !*data ) return;
data++; // '#'
StrBuf rev;
while ( *data && *data != ' ' )
{
rev.Append( data++, 1 );
}
if ( *data ) data++; // ' '
if ( *data ) data++; // '-'
if ( *data ) data++; // ' '
if ( !*data ) return;
RBFile::Action action;
switch( *data )
{
case 'a':
action = RBFile::Add;
break;
case 'b':
action = RBFile::Branch;
break;
case 'd':
action = RBFile::Delete;
break;
case 'e':
action = RBFile::Edit;
break;
case 'i':
data++;
if ( *data == 'm' ) action = RBFile::Import;
else action = RBFile::Integ;
break;
case 'p':
action = RBFile::Purge;
break;
default:
action = RBFile::None;
break;
}
if ( !path.Length() || !action ) return;
rollBack->ProcessFile( path, rev.Atoi(), action );
}
void RBUserFiles::OutputStat( StrDict *varList )
{
rollBack->SetTagged();
StrPtr* path = varList->GetVar( "depotFile" );
StrPtr* rev = varList->GetVar( "rev" );
StrPtr* act = varList->GetVar( "action" );
if ( !path || !rev || !act ) return;
RBFile::Action action = RBFile::None;
if ( *act == "add" ) action = RBFile::Add;
if ( *act == "branch" ) action = RBFile::Branch;
if ( *act == "delete" ) action = RBFile::Delete;
if ( *act == "edit" ) action = RBFile::Edit;
if ( *act == "import" ) action = RBFile::Import;
if ( *act == "integrate" ) action = RBFile::Integ;
if ( *act == "purge" ) action = RBFile::Purge;
if ( !action ) return;
rollBack->ProcessFile( *path, rev->Atoi(), action );
}
# |
Change |
User |
Description |
Committed |
|
#1
|
6342 |
Sam Stafford |
Branching px to make a fix. |
|
|
//guest/shawn_hladky/px/src/commands/rollback/RBUserFiles.cpp |
#1
|
6331 |
Shawn Hladky |
Integrating rollback into px |
|
|
//guest/sam_stafford/rollback/RBUserFiles.cpp |
#1
|
6291 |
Sam Stafford |
C++ implementation of p4rollback.pl. |
|
|