Automatic loading of remote branches #177
Replies: 8 comments
-
Hi, you're free to do any query for branches within your own code using the state branches API. I'd be happy to also take a PR adding this as an option, but I'd be interested in knowing how we could generically resolve state branch order on our own. Perhaps we need 2 concepts within the plugin, one for state branches and another for feature branches (orderless, always higher order than current branch). |
Beta Was this translation helpful? Give feedback.
-
Hi, For us the only thing that really matters is that you can't checkout files that have been modified on other feature branches until you get the changes into the current branch. Right now the ordering for this doesn't really matter right? As for querying the branches, is there a build in function for querying remote branches :o ? Thanks! |
Beta Was this translation helpful? Give feedback.
-
You can use |
Beta Was this translation helpful? Give feedback.
-
I noticed the function, but the library is currently setup so that I can't include the GitSourceControlUtils from my editor module, I get linker errors when I try to call any of the plugin's functions, even though I have added it to |
Beta Was this translation helpful? Give feedback.
-
No worries, I'll look into providing something easier soon. |
Beta Was this translation helpful? Give feedback.
-
Thanks! I think the linker error solution is to add |
Beta Was this translation helpful? Give feedback.
-
Solved it for now by adding the Async(EAsyncExecution::Thread, [ = ] {
FGitSourceControlModule & GitSourceControl = FGitSourceControlModule::Get();
if (!GitSourceControl.GetProvider().IsGitAvailable()) {
return;
}
const FString & PathToGitBinary = GitSourceControl.AccessSettings().GetBinaryPath();
const FString & RepositoryRoot = GitSourceControl.GetProvider().GetPathToRepositoryRoot();
TArray < FString > Results;
TArray < FString > Errors;
GitSourceControlUtils::RunCommand("branch", PathToGitBinary, RepositoryRoot, TArray < FString > ({
"-r"
}), TArray < FString > (), Results, Errors);
TArray < FString > Branches;
const TArray < FString > CoreBranches = {
"origin/main",
"origin/beta",
"origin/production"
};
for (int i = 0; i < Results.Num(); i++) {
FString Result = Results[i];
if (Result.Contains("->")) {
TArray < FString > Splitted;
Result.ParseIntoArray(Splitted, TEXT("->"), true);
if (Splitted.Num() == 2) {
Result = Splitted[1];
}
}
Result.RemoveSpacesInline();
if (!CoreBranches.Contains(Result)) {
Branches.Add(Result);
}
}
Branches.Append(CoreBranches);
Async(EAsyncExecution::TaskGraphMainThread, [Branches] {
const ISourceControlModule & SourceControlModule = ISourceControlModule::Get();
ISourceControlProvider & SourceControlProvider = SourceControlModule.GetProvider();
SourceControlProvider.RegisterStateBranches(Branches, TEXT("Content"));
});
}); |
Beta Was this translation helpful? Give feedback.
-
Fixed in cf8a04f |
Beta Was this translation helpful? Give feedback.
-
Hi,
For a project I'm working on, we work with feature branches. I need the plugin to automatically load the branches, for example by using
git branch -r
and add them to the RegisterStateBranches list. Right now it's rather frustrating to have to add the branches, recompile and restart the whole time.I'd like to know your thoughts on this as well. Thanks!
Beta Was this translation helpful? Give feedback.
All reactions