Skip to content

Commit

Permalink
Fix checkconnection calls by using the parameter --server=<ServerUrl>
Browse files Browse the repository at this point in the history
Call GetWorkspaceInfo() to retrieve the ServerUrl before each of these two calls
  • Loading branch information
SRombautsU committed Oct 3, 2022
1 parent b27ce86 commit 3113ce1
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -789,9 +789,16 @@ bool FPlasticUpdateStatusWorker::Execute(FPlasticSourceControlCommand& InCommand
PlasticSourceControlUtils::RemoveRedundantErrors(InCommand, TEXT("is not in a workspace."));
if (!InCommand.bCommandSuccessful)
{
TArray<FString> ErrorMessages;
TArray<FString> Parameters;
FString BranchName, RepositoryName, ServerUrl;
if (PlasticSourceControlUtils::GetWorkspaceInfo(BranchName, RepositoryName, ServerUrl, ErrorMessages))
{
Parameters.Add(FString::Printf(TEXT("--server=%s"), *ServerUrl));
}
UE_LOG(LogSourceControl, Error, TEXT("FPlasticUpdateStatusWorker(ErrorMessages.Num()=%d) => checkconnection"), InCommand.ErrorMessages.Num());
// In case of error, execute a 'checkconnection' command to check the connectivity of the server.
InCommand.bConnectionDropped = !PlasticSourceControlUtils::RunCommand(TEXT("checkconnection"), TArray<FString>(), TArray<FString>(), InCommand.Concurrency, InCommand.InfoMessages, InCommand.ErrorMessages);
InCommand.bConnectionDropped = !PlasticSourceControlUtils::RunCommand(TEXT("checkconnection"), Parameters, TArray<FString>(), InCommand.Concurrency, InCommand.InfoMessages, InCommand.ErrorMessages);
return false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,13 @@ void FPlasticSourceControlProvider::Init(bool bForceConnection)
{
// Execute a 'checkconnection' command to set bServerAvailable based on the connectivity of the server
TArray<FString> InfoMessages, ErrorMessages;
const bool bCommandSuccessful = PlasticSourceControlUtils::RunCommand(TEXT("checkconnection"), TArray<FString>(), TArray<FString>(), EConcurrency::Synchronous, InfoMessages, ErrorMessages);
bServerAvailable = bCommandSuccessful;
if (!bCommandSuccessful)
TArray<FString> Parameters;
if (PlasticSourceControlUtils::GetWorkspaceInfo(BranchName, RepositoryName, ServerUrl, ErrorMessages))
{
Parameters.Add(FString::Printf(TEXT("--server=%s"), *ServerUrl));
}
bServerAvailable = PlasticSourceControlUtils::RunCommand(TEXT("checkconnection"), Parameters, TArray<FString>(), EConcurrency::Synchronous, InfoMessages, ErrorMessages);
if (!bServerAvailable)
{
FMessageLog SourceControlLog("SourceControl");
for (const FString& ErrorMessage : ErrorMessages)
Expand Down

0 comments on commit 3113ce1

Please sign in to comment.