use of git4idea.GitStandardRemoteBranch in project intellij-community by JetBrains.
the class GitPushTarget method parse.
@NotNull
public static GitPushTarget parse(@NotNull GitRepository repository, @Nullable String remoteName, @NotNull String branchName) throws ParseException {
if (remoteName == null) {
throw new ParseException("No remotes defined", -1);
}
if (!GitRefNameValidator.getInstance().checkInput(branchName)) {
throw new ParseException("Invalid destination branch name: " + branchName, -1);
}
GitRemote remote = findRemote(repository.getRemotes(), remoteName);
if (remote == null) {
LOG.error("Remote [" + remoteName + "] is not found among " + repository.getRemotes());
throw new ParseException("Invalid remote: " + remoteName, -1);
}
GitRemoteBranch existingRemoteBranch = findRemoteBranch(repository, remote, branchName);
if (existingRemoteBranch != null) {
return new GitPushTarget(existingRemoteBranch, false);
}
GitRemoteBranch rb = new GitStandardRemoteBranch(remote, branchName);
return new GitPushTarget(rb, true);
}
use of git4idea.GitStandardRemoteBranch in project intellij-community by JetBrains.
the class GitPushResultNotificationTest method to.
private static GitRemoteBranch to(String to) {
int firstSlash = to.indexOf('/');
GitRemote remote = new GitRemote(to.substring(0, firstSlash), Collections.emptyList(), Collections.emptyList(), Collections.emptyList(), Collections.emptyList());
return new GitStandardRemoteBranch(remote, to.substring(firstSlash + 1));
}
Aggregations