You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
#rb Sebastien.Lussier
#rnx
#preflight 611e457e2c1f1c0001292a29
### ISourceControlProvider / PerforceSourceControlProvider
- Add new method ::SwitchWorkspace allowing the caller to switch the current workspace.
- Currently only implemented for perforce.
- Calling this will cause the provider to close and then re-open it's connection and so will invalidate any existing established connection or cached states. Due to this the method will fail if there are outstanding commands being processed.
- It is intended that this is only used for short periods of time, in order to submit or access files from locations that the user chosen workspace might be able to access.
- The new workspace will not be saved to the source control settings. Although this could occur later if done.
### SourceControlOperations
- Add new operation **FCreateWorkspace**.
- Currently only implemented for perforce.
- The name and the root of the workspace (filepath on the client machine) must be provided in the constructor.
- Additional mappings can be provided by calling **AddNativeClientViewMapping** which expects the mapping to be in the native format of the target source control system. At some point in the future we may add a more generic, target agnostic, format.
- Add new operation **FDeleteWorkspace**.
- Currently only implemented for perforce.
- Deletes the workspace of the given name although the workspace must be in a state where it can be deleted (no files open for add/edit/delete etc) or the operation will fail.
### PerforceConnection
- Add a new method ::CreateWorkspace for creating workspaces
- Add a new extended client 'FP4CommandWithStdInputClientUser'
- We should really extend FP4ClientUser to be able to take overridden stdinput instead but that would mean adding yet another input parameter. I'd rather keep the code separate for now and then merge them together in a future refactor where the many input parameters of ::RunCommand is replaces with a struct with TOptional members.
- Added a ::GetUser method, which returns the user of the current connection without the caller needing to know if the connection is in unicode format or not.
#ROBOMERGE-SOURCE: CL 17350788 in //UE5/Main/...
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v865-17346139)
[CL 17350796 by paul chipchase in ue5-release-engine-test branch]
133 lines
5.6 KiB
C++
133 lines
5.6 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#include "ISourceControlProvider.h"
|
|
#include "SourceControlHelpers.h"
|
|
#include "SourceControlOperations.h"
|
|
|
|
|
|
#define LOCTEXT_NAMESPACE "ISourceControlProvider"
|
|
|
|
|
|
ECommandResult::Type ISourceControlProvider::Login(const FString& InPassword, EConcurrency::Type InConcurrency, const FSourceControlOperationComplete& InOperationCompleteDelegate)
|
|
{
|
|
TSharedRef<FConnect, ESPMode::ThreadSafe> ConnectOperation = ISourceControlOperation::Create<FConnect>();
|
|
ConnectOperation->SetPassword(InPassword);
|
|
return Execute(ConnectOperation, InConcurrency, InOperationCompleteDelegate);
|
|
}
|
|
|
|
ECommandResult::Type ISourceControlProvider::GetState(const TArray<UPackage*>& InPackages, TArray<FSourceControlStateRef>& OutState, EStateCacheUsage::Type InStateCacheUsage)
|
|
{
|
|
TArray<FString> Files = SourceControlHelpers::PackageFilenames(InPackages);
|
|
return GetState(Files, OutState, InStateCacheUsage);
|
|
}
|
|
|
|
FSourceControlStatePtr ISourceControlProvider::GetState(const UPackage* InPackage, EStateCacheUsage::Type InStateCacheUsage)
|
|
{
|
|
return GetState(SourceControlHelpers::PackageFilename(InPackage), InStateCacheUsage);
|
|
}
|
|
|
|
FSourceControlStatePtr ISourceControlProvider::GetState(const FString& InFile, EStateCacheUsage::Type InStateCacheUsage)
|
|
{
|
|
TArray< FSourceControlStateRef > States;
|
|
if (GetState( { InFile }, States, InStateCacheUsage) == ECommandResult::Succeeded)
|
|
{
|
|
if (!States.IsEmpty())
|
|
{
|
|
FSourceControlStateRef State = States[0];
|
|
return State;
|
|
}
|
|
}
|
|
return nullptr;
|
|
}
|
|
|
|
FSourceControlChangelistStatePtr ISourceControlProvider::GetState(const FSourceControlChangelistRef& InChangelist, EStateCacheUsage::Type InStateCacheUsage)
|
|
{
|
|
TArray< FSourceControlChangelistStateRef > States;
|
|
if (GetState( { InChangelist }, States, InStateCacheUsage) == ECommandResult::Succeeded)
|
|
{
|
|
if (!States.IsEmpty())
|
|
{
|
|
FSourceControlChangelistStatePtr State = States[0];
|
|
return State;
|
|
}
|
|
}
|
|
return nullptr;
|
|
}
|
|
|
|
ECommandResult::Type ISourceControlProvider::Execute(const FSourceControlOperationRef& InOperation, const TArray<FString>& InFiles, EConcurrency::Type InConcurrency, const FSourceControlOperationComplete& InOperationCompleteDelegate)
|
|
{
|
|
return Execute(InOperation, nullptr, InFiles, InConcurrency, InOperationCompleteDelegate);
|
|
}
|
|
|
|
ECommandResult::Type ISourceControlProvider::Execute(const FSourceControlOperationRef& InOperation, const EConcurrency::Type InConcurrency, const FSourceControlOperationComplete& InOperationCompleteDelegate)
|
|
{
|
|
return Execute(InOperation, nullptr, TArray<FString>(), InConcurrency, InOperationCompleteDelegate);
|
|
}
|
|
|
|
ECommandResult::Type ISourceControlProvider::Execute(const FSourceControlOperationRef& InOperation, const UPackage* InPackage, const EConcurrency::Type InConcurrency, const FSourceControlOperationComplete& InOperationCompleteDelegate)
|
|
{
|
|
return Execute(InOperation, SourceControlHelpers::PackageFilename(InPackage), InConcurrency, InOperationCompleteDelegate);
|
|
}
|
|
|
|
ECommandResult::Type ISourceControlProvider::Execute(const FSourceControlOperationRef& InOperation, const FString& InFile, const EConcurrency::Type InConcurrency, const FSourceControlOperationComplete& InOperationCompleteDelegate)
|
|
{
|
|
TArray<FString> FileArray;
|
|
FileArray.Add(InFile);
|
|
return Execute(InOperation, FileArray, InConcurrency, InOperationCompleteDelegate);
|
|
}
|
|
|
|
ECommandResult::Type ISourceControlProvider::Execute(const FSourceControlOperationRef& InOperation, const TArray<UPackage*>& InPackages, const EConcurrency::Type InConcurrency, const FSourceControlOperationComplete& InOperationCompleteDelegate)
|
|
{
|
|
TArray<FString> FileArray = SourceControlHelpers::PackageFilenames(InPackages);
|
|
return Execute(InOperation, nullptr, FileArray, InConcurrency, InOperationCompleteDelegate);
|
|
}
|
|
|
|
ECommandResult::Type ISourceControlProvider::Execute(const FSourceControlOperationRef& InOperation, FSourceControlChangelistPtr InChangelist, const EConcurrency::Type InConcurrency, const FSourceControlOperationComplete& InOperationCompleteDelegate)
|
|
{
|
|
return Execute(InOperation, InChangelist, TArray<FString>(), InConcurrency, InOperationCompleteDelegate);
|
|
}
|
|
|
|
TSharedPtr<class ISourceControlLabel> ISourceControlProvider::GetLabel(const FString& InLabelName) const
|
|
{
|
|
TArray< TSharedRef<class ISourceControlLabel> > Labels = GetLabels(InLabelName);
|
|
if (Labels.Num() > 0)
|
|
{
|
|
return Labels[0];
|
|
}
|
|
|
|
return nullptr;
|
|
}
|
|
|
|
bool ISourceControlProvider::TryToDownloadFileFromBackgroundThread(const TSharedRef<class FDownloadFile>& InOperation, const FString& InFile)
|
|
{
|
|
TArray<FString> FileArray;
|
|
FileArray.Add(InFile);
|
|
|
|
return TryToDownloadFileFromBackgroundThread(InOperation, FileArray);
|
|
}
|
|
|
|
bool ISourceControlProvider::TryToDownloadFileFromBackgroundThread(const TSharedRef<class FDownloadFile>& InOperation, const TArray<FString>& InFiles)
|
|
{
|
|
// TryToDownloadFileFromBackgroundThread is unsupported by this source control provider
|
|
FFormatNamedArguments Arguments;
|
|
Arguments.Add(TEXT("ProviderName"), FText::FromName(GetName()));
|
|
FText Message = FText::Format(LOCTEXT("UnsupportedOperation", "TryToDownloadFileFromBackgroundThread is not supported by source control provider '{ProviderName}'"), Arguments);
|
|
|
|
InOperation->AddErrorMessge(Message);
|
|
|
|
return false;
|
|
}
|
|
|
|
ECommandResult::Type ISourceControlProvider::SwitchWorkspace(FStringView NewWorkspaceName, FSourceControlResultInfo& OutResultInfo, FString* OutOldWorkspaceName)
|
|
{
|
|
FFormatNamedArguments Arguments;
|
|
Arguments.Add(TEXT("ProviderName"), FText::FromName(GetName()));
|
|
FText Message = FText::Format(LOCTEXT("UnsupportedOperation", "SwitchWorkspace is not supported by source control provider '{ProviderName}'"), Arguments);
|
|
|
|
OutResultInfo.ErrorMessages.Add(Message);
|
|
|
|
return ECommandResult::Failed;
|
|
}
|
|
|
|
#undef LOCTEXT_NAMESPACE
|