本文整理汇总了C++中FSourceControlStatePtr::IsDeleted方法的典型用法代码示例。如果您正苦于以下问题:C++ FSourceControlStatePtr::IsDeleted方法的具体用法?C++ FSourceControlStatePtr::IsDeleted怎么用?C++ FSourceControlStatePtr::IsDeleted使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FSourceControlStatePtr
的用法示例。
在下文中一共展示了FSourceControlStatePtr::IsDeleted方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DeleteSourceContentFiles
void FAssetDeleteModel::DeleteSourceContentFiles()
{
IFileManager& FileManager = IFileManager::Get();
ISourceControlProvider& SourceControlProvider = ISourceControlModule::Get().GetProvider();
for (const auto& Pair : SourceFileToAssetCount)
{
const auto& Path = Pair.Key;
// We can only delete this path if there are no (non-deleted) objects referencing it
if (Pair.Value != 0)
{
continue;
}
// One way or another this file is going to be deleted, but we don't want the import manager to react to the deletion
GUnrealEd->AutoReimportManager->ReportExternalChange(Path, FFileChangeData::FCA_Removed);
if (ISourceControlModule::Get().IsEnabled())
{
const FSourceControlStatePtr SourceControlState = SourceControlProvider.GetState(Path, EStateCacheUsage::ForceUpdate);
const bool bIsSourceControlled = SourceControlState.IsValid() && SourceControlState->IsSourceControlled();
if (bIsSourceControlled)
{
// The file is managed by source control. Delete it through there.
TArray<FString> DeleteFilenames;
DeleteFilenames.Add(Path);
// Revert the file if it is checked out
const bool bIsAdded = SourceControlState->IsAdded();
if (SourceControlState->IsCheckedOut() || bIsAdded || SourceControlState->IsDeleted())
{
SourceControlProvider.Execute(ISourceControlOperation::Create<FRevert>(), DeleteFilenames);
}
// If it wasn't already marked as an add, we can ask the source control provider to delete the file
if (!bIsAdded)
{
// Open the file for delete
SourceControlProvider.Execute(ISourceControlOperation::Create<FDelete>(), DeleteFilenames);
continue;
}
}
}
// We'll just delete it ourself
FileManager.Delete(*Path, false /* RequireExists */, true /* Even if read only */, true /* Quiet */);
}
}
示例2: Main
//.........这里部分代码省略.........
CLEAR_WARN_COLOR();
return true;
}
};
if (!bIsSCCDisabled)
{
// get file SCC status
FString FileName = SourceControlHelpers::PackageFilename(PackageName);
FSourceControlStatePtr SourceControlState = SourceControlProvider.GetState(FileName, EStateCacheUsage::ForceUpdate);
if(SourceControlState.IsValid() && (SourceControlState->IsCheckedOut() || SourceControlState->IsAdded()) )
{
UE_LOG(LogFixupRedirectsCommandlet, Warning, TEXT("Revert '%s' from source control..."), *Filename);
SourceControlProvider.Execute(ISourceControlOperation::Create<FRevert>(), FileName);
SET_WARN_COLOR(COLOR_GREEN);
UE_LOG(LogFixupRedirectsCommandlet, Warning, TEXT("Deleting '%s' from source control..."), *Filename);
CLEAR_WARN_COLOR();
SourceControlProvider.Execute(ISourceControlOperation::Create<FDelete>(), FileName);
}
else if(SourceControlState.IsValid() && SourceControlState->CanCheckout())
{
SET_WARN_COLOR(COLOR_GREEN);
UE_LOG(LogFixupRedirectsCommandlet, Warning, TEXT("Deleting '%s' from source control..."), *Filename);
CLEAR_WARN_COLOR();
SourceControlProvider.Execute(ISourceControlOperation::Create<FDelete>(), FileName);
}
else if(SourceControlState.IsValid() && SourceControlState->IsCheckedOutOther())
{
SET_WARN_COLOR(COLOR_RED);
UE_LOG(LogFixupRedirectsCommandlet, Warning, TEXT("Couldn't delete '%s' from source control, someone has it checked out, skipping..."), *Filename);
CLEAR_WARN_COLOR();
}
else if(SourceControlState.IsValid() && !SourceControlState->IsSourceControlled())
{
if(Local::DeleteFromDisk(Filename, FString::Printf(TEXT("'%s' is not in source control, attempting to delete from disk..."), *Filename)))
{
LogOutputFile->Logf(*Filename);
}
}
else
{
if(Local::DeleteFromDisk(Filename, FString::Printf(TEXT("'%s' is in an unknown source control state, attempting to delete from disk..."), *Filename)))
{
LogOutputFile->Logf(*Filename);
}
}
}
else
{
if(Local::DeleteFromDisk(Filename, FString::Printf(TEXT("source control disabled while deleting '%s', attempting to delete from disk..."), *Filename)))
{
LogOutputFile->Logf(*Filename);
}
}
}
}
LogOutputFile->Close();
delete LogOutputFile;
LogOutputFile = NULL;
if (!bIsSCCDisabled && bAutoSubmit)
{
/////////////////////////////////////////////////////////////////////
// Submit the results to source control
/////////////////////////////////////////////////////////////////////
UE_LOG(LogFixupRedirectsCommandlet, Display, TEXT("Submiting the results to source control"));
// Work out the list of file to check in
TArray <FString> FilesToSubmit;
for( int32 PackageIndex = 0; PackageIndex < PackageList.Num(); PackageIndex++ )
{
const FString& Filename = PackageList[PackageIndex];
FString PackageName(FPackageName::FilenameToLongPackageName(Filename));
FSourceControlStatePtr SourceControlState = SourceControlProvider.GetState(SourceControlHelpers::PackageFilename(Filename), EStateCacheUsage::ForceUpdate);
if( SourceControlState.IsValid() && (SourceControlState->IsCheckedOut() || SourceControlState->IsAdded() || SourceControlState->IsDeleted()) )
{
// Only submit engine packages if we're requested to
if( bUpdateEnginePackages || !Filename.StartsWith( FPaths::EngineDir() ) )
{
FilesToSubmit.Add(*PackageName);
}
}
}
// Check in all changed files
const FText Description = NSLOCTEXT("FixupRedirectsCmdlet", "ChangelistDescription", "Fixed up Redirects");
TSharedRef<FCheckIn, ESPMode::ThreadSafe> CheckInOperation = ISourceControlOperation::Create<FCheckIn>();
CheckInOperation->SetDescription( Description );
SourceControlProvider.Execute(CheckInOperation, SourceControlHelpers::PackageFilenames(FilesToSubmit));
// toss the SCC manager
ISourceControlModule::Get().GetProvider().Close();
}
return 0;
}
示例3: DeleteFromSourceControl
bool FCollection::DeleteFromSourceControl(FText& OutError)
{
ISourceControlProvider& SourceControlProvider = ISourceControlModule::Get().GetProvider();
if ( !ISourceControlModule::Get().IsEnabled() )
{
OutError = LOCTEXT("Error_SCCDisabled", "Source control is not enabled. Enable source control in the preferences menu.");
return false;
}
if ( !SourceControlProvider.IsAvailable() )
{
OutError = LOCTEXT("Error_SCCNotAvailable", "Source control is currently not available. Check your connection and try again.");
return false;
}
bool bDeletedSuccessfully = false;
const int32 DeleteProgressDenominator = 2;
int32 DeleteProgressNumerator = 0;
const FText CollectionNameText = FText::FromName( CollectionName );
FFormatNamedArguments Args;
Args.Add( TEXT("CollectionName"), CollectionNameText );
const FText StatusUpdate = FText::Format( LOCTEXT("DeletingCollection", "Deleting Collection {CollectionName}"), Args );
GWarn->BeginSlowTask( StatusUpdate, true );
GWarn->UpdateProgress(DeleteProgressNumerator++, DeleteProgressDenominator);
FString AbsoluteFilename = FPaths::ConvertRelativePathToFull(SourceFilename);
FSourceControlStatePtr SourceControlState = SourceControlProvider.GetState(AbsoluteFilename, EStateCacheUsage::ForceUpdate);
GWarn->UpdateProgress(DeleteProgressNumerator++, DeleteProgressDenominator);
// If checked out locally for some reason, revert
if (SourceControlState.IsValid() && (SourceControlState->IsAdded() || SourceControlState->IsCheckedOut() || SourceControlState->IsDeleted()))
{
if ( !RevertCollection(OutError) )
{
// Failed to revert, just bail out
GWarn->EndSlowTask();
return false;
}
// Make sure we get a fresh state from the server
SourceControlState = SourceControlProvider.GetState(AbsoluteFilename, EStateCacheUsage::ForceUpdate);
}
// If not at the head revision, sync up
if (SourceControlState.IsValid() && !SourceControlState->IsCurrent())
{
if ( SourceControlProvider.Execute(ISourceControlOperation::Create<FSync>(), AbsoluteFilename) == ECommandResult::Failed)
{
// Could not sync up with the head revision
GWarn->EndSlowTask();
OutError = FText::Format(LOCTEXT("Error_SCCSync", "Failed to sync collection '{0}' to the head revision."), FText::FromName(CollectionName));
return false;
}
// Check to see if the file exists at the head revision
if ( !IFileManager::Get().FileExists(*SourceFilename) )
{
// File was already deleted, consider this a success
GWarn->EndSlowTask();
return true;
}
FCollection NewCollection(SourceFilename, false);
FText LoadErrorText;
if ( !NewCollection.Load(LoadErrorText) )
{
// Failed to load the head revision file so it isn't safe to delete it
GWarn->EndSlowTask();
OutError = FText::Format(LOCTEXT("Error_SCCBadHead", "Failed to load the collection '{0}' at the head revision. {1}"), FText::FromName(CollectionName), LoadErrorText);
return false;
}
// Loaded the head revision, now merge up so the files are in a consistent state
MergeWithCollection(NewCollection);
// Make sure we get a fresh state from the server
SourceControlState = SourceControlProvider.GetState(AbsoluteFilename, EStateCacheUsage::ForceUpdate);
}
GWarn->UpdateProgress(DeleteProgressNumerator++, DeleteProgressDenominator);
if(SourceControlState.IsValid())
{
if(SourceControlState->IsAdded() || SourceControlState->IsCheckedOut())
{
OutError = FText::Format(LOCTEXT("Error_SCCDeleteWhileCheckedOut", "Failed to delete collection '{0}' in source control because it is checked out or open for add."), FText::FromName(CollectionName));
}
else if(SourceControlState->CanCheckout())
{
if ( SourceControlProvider.Execute(ISourceControlOperation::Create<FDelete>(), AbsoluteFilename) == ECommandResult::Succeeded )
{
// Now check in the delete
const FText ChangelistDesc = FText::Format( LOCTEXT("CollectionDeletedDesc", "Deleted collection: {CollectionName}"), CollectionNameText );
TSharedRef<FCheckIn, ESPMode::ThreadSafe> CheckInOperation = ISourceControlOperation::Create<FCheckIn>();
CheckInOperation->SetDescription(ChangelistDesc);
//.........这里部分代码省略.........
示例4: CheckoutCollection
bool FCollection::CheckoutCollection(FText& OutError)
{
if ( !ensure(SourceFilename.Len()) )
{
OutError = LOCTEXT("Error_Internal", "There was an internal error.");
return false;
}
ISourceControlProvider& SourceControlProvider = ISourceControlModule::Get().GetProvider();
if ( !ISourceControlModule::Get().IsEnabled() )
{
OutError = LOCTEXT("Error_SCCDisabled", "Source control is not enabled. Enable source control in the preferences menu.");
return false;
}
if ( !SourceControlProvider.IsAvailable() )
{
OutError = LOCTEXT("Error_SCCNotAvailable", "Source control is currently not available. Check your connection and try again.");
return false;
}
const FString AbsoluteFilename = FPaths::ConvertRelativePathToFull(SourceFilename);
FSourceControlStatePtr SourceControlState = SourceControlProvider.GetState(AbsoluteFilename, EStateCacheUsage::ForceUpdate);
bool bSuccessfullyCheckedOut = false;
if (SourceControlState.IsValid() && SourceControlState->IsDeleted())
{
// Revert our delete
if ( !RevertCollection(OutError) )
{
return false;
}
// Make sure we get a fresh state from the server
SourceControlState = SourceControlProvider.GetState(AbsoluteFilename, EStateCacheUsage::ForceUpdate);
}
// If not at the head revision, sync up
if (SourceControlState.IsValid() && !SourceControlState->IsCurrent())
{
if ( SourceControlProvider.Execute(ISourceControlOperation::Create<FSync>(), AbsoluteFilename) == ECommandResult::Failed )
{
// Could not sync up with the head revision
OutError = FText::Format(LOCTEXT("Error_SCCSync", "Failed to sync collection '{0}' to the head revision."), FText::FromName(CollectionName));
return false;
}
// Check to see if the file exists at the head revision
if ( IFileManager::Get().FileExists(*SourceFilename) )
{
// File found! Load it and merge with our local changes
FText LoadErrorText;
FCollection NewCollection(SourceFilename, false);
if ( !NewCollection.Load(LoadErrorText) )
{
// Failed to load the head revision file so it isn't safe to delete it
OutError = FText::Format(LOCTEXT("Error_SCCBadHead", "Failed to load the collection '{0}' at the head revision. {1}"), FText::FromName(CollectionName), LoadErrorText);
return false;
}
// Loaded the head revision, now merge up so the files are in a consistent state
MergeWithCollection(NewCollection);
}
// Make sure we get a fresh state from the server
SourceControlState = SourceControlProvider.GetState(AbsoluteFilename, EStateCacheUsage::ForceUpdate);
}
if(SourceControlState.IsValid())
{
if(!SourceControlState->IsSourceControlled())
{
// Not yet in the depot. We'll add it when we call CheckinCollection
bSuccessfullyCheckedOut = true;
}
else if(SourceControlState->IsAdded() || SourceControlState->IsCheckedOut())
{
// Already checked out or opened for add
bSuccessfullyCheckedOut = true;
}
else if(SourceControlState->CanCheckout())
{
// In depot and needs to be checked out
bSuccessfullyCheckedOut = (SourceControlProvider.Execute(ISourceControlOperation::Create<FCheckOut>(), AbsoluteFilename) == ECommandResult::Succeeded);
if (!bSuccessfullyCheckedOut)
{
OutError = FText::Format(LOCTEXT("Error_SCCCheckout", "Failed to check out collection '{0}'"), FText::FromName(CollectionName));
}
}
else if(!SourceControlState->IsCurrent())
{
OutError = FText::Format(LOCTEXT("Error_SCCNotCurrent", "Collection '{0}' is not at head revision after sync."), FText::FromName(CollectionName));
}
else if(SourceControlState->IsCheckedOutOther())
{
OutError = FText::Format(LOCTEXT("Error_SCCCheckedOutOther", "Collection '{0}' is checked out by another user."), FText::FromName(CollectionName));
}
else
{
//.........这里部分代码省略.........