-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #105 from PlasticSCM/1004476-fix-get-user-name-mul…
…ti-account Fix getting the username in the case of using multiple accounts
- Loading branch information
Showing
5 changed files
with
76 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,17 +25,46 @@ namespace PlasticSourceControlParsers | |
#define FILE_STATUS_SEPARATOR TEXT(";") | ||
|
||
|
||
/** | ||
* Parse the output of the "cm profile list --format="{server};{user}" command | ||
* | ||
* Example: | ||
localhost:8087|sebastien.rombauts | ||
local|[email protected] | ||
SRombautsU@cloud|[email protected] | ||
*/ | ||
bool ParseProfileInfo(TArray<FString>& InResults, const FString& InServerUrl, FString& OutUserName) | ||
{ | ||
for (const FString& Result : InResults) | ||
{ | ||
TArray<FString> ProfileInfos; | ||
Result.ParseIntoArray(ProfileInfos, FILE_STATUS_SEPARATOR, false); // Don't cull empty values | ||
if (ProfileInfos.Num() == 2) | ||
{ | ||
if (ProfileInfos[0] == InServerUrl) | ||
{ | ||
OutUserName = ProfileInfos[1]; | ||
return true; | ||
} | ||
} | ||
} | ||
|
||
return false; | ||
} | ||
|
||
/** | ||
* Parse workspace information, in the form "Branch /main@UE5PlasticPluginDev@localhost:8087" | ||
* or "Branch /main@UE5PlasticPluginDev@test@cloud" (when connected to the cloud) | ||
* or "Branch /main@rep:UE5OpenWorldPerfTest@repserver:test@cloud" | ||
* or "Changeset 1234@UE5PlasticPluginDev@test@cloud" (when the workspace is switched on a changeset instead of a branch) | ||
*/ | ||
bool ParseWorkspaceInfo(TArray<FString>& InResults, FString& OutBranchName, FString& OutRepositoryName, FString& OutServerUrl) | ||
{ | ||
if (InResults.Num() == 0) | ||
{ | ||
return false; | ||
} | ||
|
||
// Get workspace information, in the form "Branch /main@UE5PlasticPluginDev@localhost:8087" | ||
// or "Branch /main@UE5PlasticPluginDev@test@cloud" (when connected to the cloud) | ||
// or "Branch /main@rep:UE5OpenWorldPerfTest@repserver:test@cloud" | ||
// or "Changeset 1234@UE5PlasticPluginDev@test@cloud" (when the workspace is switched on a changeset instead of a branch) | ||
static const FString BranchPrefix(TEXT("Branch ")); | ||
static const FString ChangesetPrefix(TEXT("Changeset ")); | ||
static const FString LabelPrefix(TEXT("Label ")); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters