本文整理汇总了C++中FSourceControlStatePtr类的典型用法代码示例。如果您正苦于以下问题:C++ FSourceControlStatePtr类的具体用法?C++ FSourceControlStatePtr怎么用?C++ FSourceControlStatePtr使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了FSourceControlStatePtr类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: check
TSharedRef<SDockTab> FMerge::GenerateMergeWidget(const UBlueprint& Object, TSharedRef<FBlueprintEditor> Editor)
{
auto ActiveTabPtr = ActiveTab.Pin();
if( ActiveTabPtr.IsValid() )
{
// just bring the tab to the foreground:
auto CurrentTab = FGlobalTabmanager::Get()->InvokeTab(MergeToolTabId);
check( CurrentTab == ActiveTabPtr );
return ActiveTabPtr.ToSharedRef();
}
// merge the local asset with the depot, SCC provides us with the last common revision as
// a basis for the merge:
TSharedPtr<SWidget> Contents;
if (!PendingMerge(Object))
{
// this should load up the merge-tool, with an asset picker, where they
// can pick the asset/revisions to merge against
Contents = GenerateMergeTabContents(Editor, nullptr, FRevisionInfo::InvalidRevision(), nullptr, FRevisionInfo::InvalidRevision(), &Object, FOnMergeResolved());
}
else
{
// @todo DO: this will probably need to be async.. pulling down some old versions of assets:
const FString& PackageName = Object.GetOutermost()->GetName();
const FString& AssetName = Object.GetName();
FSourceControlStatePtr SourceControlState = FMergeToolUtils::GetSourceControlState(PackageName);
if (!SourceControlState.IsValid())
{
DisplayErrorMessage(
FText::Format(
LOCTEXT("MergeFailedNoSourceControl", "Aborted Load of {0} from {1} because the source control state was invalidated")
, FText::FromString(AssetName)
, FText::FromString(PackageName)
)
);
Contents = SNew(SHorizontalBox);
}
else
{
ISourceControlState const& SourceControlStateRef = *SourceControlState;
FRevisionInfo CurrentRevInfo = FRevisionInfo::InvalidRevision();
const UBlueprint* RemoteBlueprint = Cast< UBlueprint >(LoadHeadRev(PackageName, AssetName, SourceControlStateRef, CurrentRevInfo));
FRevisionInfo BaseRevInfo = FRevisionInfo::InvalidRevision();
const UBlueprint* BaseBlueprint = Cast< UBlueprint >(LoadBaseRev(PackageName, AssetName, SourceControlStateRef, BaseRevInfo));
Contents = GenerateMergeTabContents(Editor, BaseBlueprint, BaseRevInfo, RemoteBlueprint, CurrentRevInfo, &Object, FOnMergeResolved());
}
}
TSharedRef<SDockTab> Tab = FGlobalTabmanager::Get()->InvokeTab(MergeToolTabId);
Tab->SetContent(Contents.ToSharedRef());
ActiveTab = Tab;
return Tab;
}
示例2: GetSetupStateBasedOnFile
SPlatformSetupMessage::ESetupState SPlatformSetupMessage::GetSetupStateBasedOnFile(bool bForce) const
{
if (!FPaths::FileExists(TargetFilename))
{
return MissingFiles;
}
else
{
ISourceControlModule& SCC = ISourceControlModule::Get();
if (SCC.IsEnabled() && SCC.GetProvider().IsAvailable())
{
ISourceControlProvider& Provider = SCC.GetProvider();
FSourceControlStatePtr SourceControlState = Provider.GetState(TargetFilename, bForce ? EStateCacheUsage::ForceUpdate : EStateCacheUsage::Use);
if (SourceControlState.IsValid())
{
if (SourceControlState->IsSourceControlled())
{
if (SourceControlState->CanCheckout())
{
return NeedsCheckout;
}
}
else
{
//@TODO: Should we instead try to add the file?
}
}
}
// SCC is disabled or unavailable
const bool bIsReadOnly = FPlatformFileManager::Get().GetPlatformFile().IsReadOnly(*TargetFilename);
return bIsReadOnly ? ReadOnlyFiles : ReadyToModify;
}
}
示例3: Update
bool FGetStateLatentCommand::Update()
{
FSourceControlStatePtr SourceControlState = ISourceControlModule::Get().GetProvider().GetState(SourceControlHelpers::PackageFilename(Filename), EStateCacheUsage::Use);
if(!SourceControlState.IsValid())
{
UE_LOG(LogSourceControl, Error, TEXT("Failed to get a valid state for file: %s"), *Filename);
}
else
{
if(!SourceControlState->IsCheckedOut())
{
UE_LOG(LogSourceControl, Error, TEXT("File '%s' should be checked out, but isnt."), *Filename);
}
else
{
if(SourceControlState->GetHistorySize() == 0)
{
UE_LOG(LogSourceControl, Error, TEXT("Failed to get a valid history for file: %s"), *Filename);
}
else
{
TSharedPtr<ISourceControlRevision, ESPMode::ThreadSafe> HistoryItem = SourceControlState->GetHistoryItem(0);
if(!HistoryItem.IsValid())
{
UE_LOG(LogSourceControl, Error, TEXT("Failed to get a valid history item 0 for file: %s"), *Filename);
}
}
}
}
return true;
}
示例4: UpdateProjectSourceControl
void FCollectionContextMenu::UpdateProjectSourceControl()
{
// Force update of source control so that we're always showing the valid options
bProjectUnderSourceControl = false;
if(ISourceControlModule::Get().IsEnabled() && ISourceControlModule::Get().GetProvider().IsAvailable() && FPaths::IsProjectFilePathSet())
{
FSourceControlStatePtr SourceControlState = ISourceControlModule::Get().GetProvider().GetState(FPaths::GetProjectFilePath(), EStateCacheUsage::ForceUpdate);
bProjectUnderSourceControl = (SourceControlState->IsSourceControlled() && !SourceControlState->IsIgnored() && !SourceControlState->IsUnknown());
}
}
示例5: GetSCCStateImage
const FSlateBrush* SWorldHierarchyItem::GetSCCStateImage() const
{
FSourceControlStatePtr SourceControlState = ISourceControlModule::Get().GetProvider().GetState(LevelModel->GetPackageFileName(), EStateCacheUsage::Use);
if(SourceControlState.IsValid())
{
return FEditorStyle::GetBrush(SourceControlState->GetSmallIconName());
}
return NULL;
}
示例6: GetSCCStateTooltip
FText SWorldHierarchyItem::GetSCCStateTooltip() const
{
FSourceControlStatePtr SourceControlState = ISourceControlModule::Get().GetProvider().GetState(LevelModel->GetPackageFileName(), EStateCacheUsage::Use);
if(SourceControlState.IsValid())
{
return SourceControlState->GetDisplayTooltip();
}
return FText::GetEmpty();
}
示例7: GetPackageNamesInSelectedPaths
void FPathContextMenu::ExecuteSCCOpenForAdd()
{
ISourceControlProvider& SourceControlProvider = ISourceControlModule::Get().GetProvider();
// Get a list of package names in the selected paths
TArray<FString> PackageNames;
GetPackageNamesInSelectedPaths(PackageNames);
TArray<FString> PackagesToAdd;
TArray<UPackage*> PackagesToSave;
for ( auto PackageIt = PackageNames.CreateConstIterator(); PackageIt; ++PackageIt )
{
FSourceControlStatePtr SourceControlState = SourceControlProvider.GetState(SourceControlHelpers::PackageFilename(*PackageIt), EStateCacheUsage::Use);
if ( SourceControlState.IsValid() && !SourceControlState->IsSourceControlled() )
{
PackagesToAdd.Add(*PackageIt);
// Make sure the file actually exists on disk before adding it
FString Filename;
if ( !FPackageName::DoesPackageExist(*PackageIt, NULL, &Filename) )
{
UPackage* Package = FindPackage(NULL, **PackageIt);
if ( Package )
{
PackagesToSave.Add(Package);
}
}
}
}
if ( PackagesToAdd.Num() > 0 )
{
// If any of the packages are new, save them now
if ( PackagesToSave.Num() > 0 )
{
const bool bCheckDirty = false;
const bool bPromptToSave = false;
TArray<UPackage*> FailedPackages;
const FEditorFileUtils::EPromptReturnCode Return = FEditorFileUtils::PromptForCheckoutAndSave(PackagesToSave, bCheckDirty, bPromptToSave, &FailedPackages);
if(FailedPackages.Num() > 0)
{
// don't try and add files that failed to save - remove them from the list
for(auto FailedPackageIt = FailedPackages.CreateConstIterator(); FailedPackageIt; FailedPackageIt++)
{
PackagesToAdd.Remove((*FailedPackageIt)->GetName());
}
}
}
if ( PackagesToAdd.Num() > 0 )
{
SourceControlProvider.Execute(ISourceControlOperation::Create<FMarkForAdd>(), SourceControlHelpers::PackageFilenames(PackagesToAdd));
}
}
}
示例8: SlowTask
void FAssetFixUpRedirectors::LoadReferencingPackages(TArray<FRedirectorRefs>& RedirectorsToFix, TArray<UPackage*>& OutReferencingPackagesToSave) const
{
FScopedSlowTask SlowTask( RedirectorsToFix.Num(), LOCTEXT( "LoadingReferencingPackages", "Loading Referencing Packages..." ) );
SlowTask.MakeDialog();
ISourceControlProvider& SourceControlProvider = ISourceControlModule::Get().GetProvider();
// Load all packages that reference each redirector, if possible
for ( auto RedirectorRefsIt = RedirectorsToFix.CreateIterator(); RedirectorRefsIt; ++RedirectorRefsIt )
{
SlowTask.EnterProgressFrame(1);
FRedirectorRefs& RedirectorRefs = *RedirectorRefsIt;
if ( ISourceControlModule::Get().IsEnabled() )
{
FSourceControlStatePtr SourceControlState = SourceControlProvider.GetState(RedirectorRefs.Redirector->GetOutermost(), EStateCacheUsage::Use);
const bool bValidSCCState = !SourceControlState.IsValid() || SourceControlState->IsAdded() || SourceControlState->IsCheckedOut() || SourceControlState->CanCheckout() || !SourceControlState->IsSourceControlled() || SourceControlState->IsIgnored();
if ( !bValidSCCState )
{
RedirectorRefs.bRedirectorValidForFixup = false;
RedirectorRefs.FailureReason = LOCTEXT("RedirectorFixupFailed_BadSCC", "Redirector could not be checked out or marked for delete");
}
}
// Load all referencers
for ( auto PackageNameIt = RedirectorRefs.ReferencingPackageNames.CreateConstIterator(); PackageNameIt; ++PackageNameIt )
{
const FString PackageName = (*PackageNameIt).ToString();
// Find the package in memory. If it is not in memory, try to load it
UPackage* Package = FindPackage(NULL, *PackageName);
if ( !Package )
{
Package = LoadPackage(NULL, *PackageName, LOAD_None);
}
if ( Package )
{
if ( Package->PackageFlags & PKG_CompiledIn )
{
// This is a script reference
RedirectorRefs.bRedirectorValidForFixup = false;
RedirectorRefs.FailureReason = FText::Format(LOCTEXT("RedirectorFixupFailed_CodeReference", "Redirector is referenced by code. Package: {0}"), FText::FromString(PackageName));
}
else
{
// If we found a valid package, mark it for save
OutReferencingPackagesToSave.AddUnique(Package);
}
}
}
}
}
示例9: PendingMerge
bool FMerge::PendingMerge(const UBlueprint& BlueprintObj) const
{
ISourceControlProvider& SourceControlProvider = ISourceControlModule::Get().GetProvider();
bool bPendingMerge = false;
if( SourceControlProvider.IsEnabled() )
{
FSourceControlStatePtr SourceControlState = SourceControlProvider.GetState(BlueprintObj.GetOutermost(), EStateCacheUsage::Use);
bPendingMerge = SourceControlState.IsValid() && SourceControlState->IsConflicted();
}
return bPendingMerge;
}
示例10: TEXT
bool FGatherTextSCC::RevertFile( const FString& InFile, FString& OutError )
{
if( InFile.IsEmpty() )
{
OutError = TEXT("Could not revert file.");
return false;
}
FString SCCError;
if( !IsReady( SCCError ) )
{
OutError = SCCError;
return false;
}
FString AbsoluteFilename = FPaths::ConvertRelativePathToFull(InFile);
ISourceControlProvider& SourceControlProvider = ISourceControlModule::Get().GetProvider();
FSourceControlStatePtr SourceControlState = SourceControlProvider.GetState( AbsoluteFilename, EStateCacheUsage::ForceUpdate );
bool bSuccessfullyReverted = false;
TArray<FString> FilesToRevert;
FilesToRevert.Add(AbsoluteFilename);
if( SourceControlState.IsValid() && !SourceControlState->IsCheckedOut() && !SourceControlState->IsAdded() )
{
bSuccessfullyReverted = true;
}
else
{
bSuccessfullyReverted = (SourceControlProvider.Execute(ISourceControlOperation::Create<FRevert>(), FilesToRevert) == ECommandResult::Succeeded);
}
if(!bSuccessfullyReverted)
{
OutError = TEXT("Could not revert file.");
}
else
{
CheckedOutFiles.Remove( AbsoluteFilename );
}
return bSuccessfullyReverted;
}
示例11: Tick
void SSettingsEditorCheckoutNotice::Tick(const FGeometry& AllottedGeometry, const double InCurrentTime, const float InDeltaTime)
{
SCompoundWidget::Tick(AllottedGeometry, InCurrentTime, InDeltaTime);
// cache selected settings object's configuration file state
DefaultConfigCheckOutTimer += InDeltaTime;
if (DefaultConfigCheckOutTimer >= 1.0f)
{
bool NewCheckOutNeeded = false;
DefaultConfigQueryInProgress = true;
FString CachedConfigFileName = ConfigFilePath.Get();
if (!CachedConfigFileName.IsEmpty())
{
if (ISourceControlModule::Get().IsEnabled())
{
// note: calling QueueStatusUpdate often does not spam status updates as an internal timer prevents this
ISourceControlModule::Get().QueueStatusUpdate(CachedConfigFileName);
ISourceControlProvider& SourceControlProvider = ISourceControlModule::Get().GetProvider();
FSourceControlStatePtr SourceControlState = SourceControlProvider.GetState(CachedConfigFileName, EStateCacheUsage::Use);
NewCheckOutNeeded = SourceControlState.IsValid() && SourceControlState->CanCheckout();
DefaultConfigQueryInProgress = SourceControlState.IsValid() && SourceControlState->IsUnknown();
}
else
{
NewCheckOutNeeded = (FPaths::FileExists(CachedConfigFileName) && IFileManager::Get().IsReadOnly(*CachedConfigFileName));
DefaultConfigQueryInProgress = false;
}
// file has been checked in or reverted
if ((NewCheckOutNeeded == true) && (DefaultConfigCheckOutNeeded == false))
{
OnFileProbablyModifiedExternally.ExecuteIfBound();
}
}
DefaultConfigCheckOutNeeded = NewCheckOutNeeded;
DefaultConfigCheckOutTimer = 0.0f;
}
}
示例12: CheckinFiles
bool FGatherTextSCC::CheckinFiles( const FString& InChangeDescription, FString& OutError )
{
if( CheckedOutFiles.Num() == 0 )
{
return true;
}
FString SCCError;
if( !IsReady( SCCError ) )
{
OutError = SCCError;
return false;
}
ISourceControlProvider& SourceControlProvider = ISourceControlModule::Get().GetProvider();
SourceControlHelpers::RevertUnchangedFiles(SourceControlProvider, CheckedOutFiles);
// remove unchanged files
for (int32 VerifyIndex = CheckedOutFiles.Num()-1; VerifyIndex >= 0; --VerifyIndex)
{
FSourceControlStatePtr SourceControlState = SourceControlProvider.GetState( CheckedOutFiles[VerifyIndex], EStateCacheUsage::ForceUpdate );
if (SourceControlState.IsValid() && !SourceControlState->IsCheckedOut() && !SourceControlState->IsAdded())
{
CheckedOutFiles.RemoveAt(VerifyIndex);
}
}
if (CheckedOutFiles.Num() > 0)
{
TSharedRef<FCheckIn, ESPMode::ThreadSafe> CheckInOperation = ISourceControlOperation::Create<FCheckIn>();
CheckInOperation->SetDescription(InChangeDescription);
if (!SourceControlProvider.Execute( CheckInOperation, CheckedOutFiles ))
{
OutError = TEXT("The checked out localization files could not be checked in.");
return false;
}
CheckedOutFiles.Empty();
}
return true;
}
示例13: GetFilenamesList
void FLevelCollectionModel::SCCOpenForAdd(const FLevelModelList& InList)
{
ISourceControlProvider& SourceControlProvider = ISourceControlModule::Get().GetProvider();
TArray<FString> FilenamesList = GetFilenamesList(InList);
TArray<FString> FilenamesToAdd;
TArray<UPackage*> PackagesToSave;
for (auto It = FilenamesList.CreateConstIterator(); It; ++It)
{
const FSourceControlStatePtr SourceControlState = SourceControlProvider.GetState(*It, EStateCacheUsage::Use);
if (SourceControlState.IsValid() && !SourceControlState->IsSourceControlled())
{
FilenamesToAdd.Add(*It);
// Make sure the file actually exists on disk before adding it
FString LongPackageName = FPackageName::FilenameToLongPackageName(*It);
if (!FPackageName::DoesPackageExist(LongPackageName))
{
UPackage* Package = FindPackage(NULL, *LongPackageName);
if (Package)
{
PackagesToSave.Add(Package);
}
}
}
}
if (FilenamesToAdd.Num() > 0)
{
// If any of the packages are new, save them now
if (PackagesToSave.Num() > 0)
{
const bool bCheckDirty = false;
const bool bPromptToSave = false;
const auto Return = FEditorFileUtils::PromptForCheckoutAndSave(PackagesToSave, bCheckDirty, bPromptToSave);
}
SourceControlProvider.Execute(ISourceControlOperation::Create<FMarkForAdd>(), FilenamesToAdd);
}
}
示例14: LOCTEXT
bool FCollection::RevertCollection(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;
}
FString AbsoluteFilename = FPaths::ConvertRelativePathToFull(SourceFilename);
FSourceControlStatePtr SourceControlState = SourceControlProvider.GetState(AbsoluteFilename, EStateCacheUsage::ForceUpdate);
if ( SourceControlState.IsValid() && !(SourceControlState->IsCheckedOut() || SourceControlState->IsAdded()) )
{
OutError = FText::Format(LOCTEXT("Error_SCCNotCheckedOut", "Collection '{0}' not checked out or open for add."), FText::FromName(CollectionName));
return false;
}
if ( SourceControlProvider.Execute(ISourceControlOperation::Create<FRevert>(), AbsoluteFilename) == ECommandResult::Succeeded)
{
return true;
}
else
{
OutError = FText::Format(LOCTEXT("Error_SCCRevert", "Could not revert collection '{0}'"), FText::FromName(CollectionName));
return false;
}
}
示例15: OnPackageCheckedOut
void UUnrealEdEngine::OnPackageCheckedOut(const FSourceControlOperationRef& SourceControlOp, ECommandResult::Type ResultType, TWeakObjectPtr<UPackage> Package)
{
if (Package.IsValid())
{
// Get the source control state of the package
ISourceControlProvider& SourceControlProvider = ISourceControlModule::Get().GetProvider();
FSourceControlStatePtr SourceControlState = SourceControlProvider.GetState(Package.Get(), EStateCacheUsage::Use);
FFormatNamedArguments Arguments;
Arguments.Add(TEXT("Package"), FText::FromString(Package->GetName()));
if (ResultType == ECommandResult::Succeeded)
{
if (SourceControlState.IsValid() && SourceControlState->IsCheckedOut())
{
FNotificationInfo Notification(FText::Format(NSLOCTEXT("SourceControl", "AutoCheckOutNotification", "Package '{Package}' automatically checked out."), Arguments));
Notification.bFireAndForget = true;
Notification.ExpireDuration = 4.0f;
Notification.bUseThrobber = true;
FSlateNotificationManager::Get().AddNotification(Notification);
return;
}
}
FNotificationInfo ErrorNotification(FText::Format(NSLOCTEXT("SourceControl", "AutoCheckOutFailedNotification", "Unable to automatically check out Package '{Package}'."), Arguments));
ErrorNotification.bFireAndForget = true;
ErrorNotification.ExpireDuration = 4.0f;
ErrorNotification.bUseThrobber = true;
FSlateNotificationManager::Get().AddNotification(ErrorNotification);
// Automatic checkout failed - pop up the notification for manual checkout
PackageToNotifyState.Add(Package, SourceControlState->CanCheckout() ? NS_PendingPrompt : NS_PendingWarning);
bNeedToPromptForCheckout = true;
}
}