use of git4idea.repo.GitRemote in project intellij-community by JetBrains.
the class GitFetcher method fetchAll.
@NotNull
private static GitFetchResult fetchAll(@NotNull GitRepository repository) {
GitFetchResult fetchResult = GitFetchResult.success();
for (GitRemote remote : repository.getRemotes()) {
String url = remote.getFirstUrl();
if (url == null) {
LOG.error("URL is null for remote " + remote.getName());
continue;
}
GitFetchResult res = fetchNatively(repository, remote, null);
res.addPruneInfo(fetchResult.getPrunedRefs());
fetchResult = res;
if (!fetchResult.isSuccess()) {
break;
}
}
return fetchResult;
}
use of git4idea.repo.GitRemote 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));
}
use of git4idea.repo.GitRemote in project intellij-community by JetBrains.
the class GitFetcher method fetchCurrentBranch.
// leaving this unused method, because the wanted behavior can change again
@SuppressWarnings("UnusedDeclaration")
@NotNull
private GitFetchResult fetchCurrentBranch(@NotNull GitRepository repository) {
FetchParams fetchParams = getFetchParams(repository);
if (fetchParams.isError()) {
return fetchParams.getError();
}
GitRemote remote = fetchParams.getRemote();
String remoteBranch = fetchParams.getRemoteBranch().getNameForRemoteOperations();
return fetchNatively(repository, remote, remoteBranch);
}
use of git4idea.repo.GitRemote in project intellij-community by JetBrains.
the class GitFetcher method fetchCurrentRemote.
@NotNull
private GitFetchResult fetchCurrentRemote(@NotNull GitRepository repository) {
FetchParams fetchParams = getFetchParams(repository);
if (fetchParams.isError()) {
return fetchParams.getError();
}
GitRemote remote = fetchParams.getRemote();
return fetchRemote(repository, remote, null);
}
use of git4idea.repo.GitRemote in project intellij-community by JetBrains.
the class GitBranchUtil method tracked.
/**
* Get the tracking branch for the given branch, or null if the given branch doesn't track anything.
* @deprecated Use {@link GitConfig#getBranchTrackInfos()}
*/
@Deprecated
@Nullable
public static GitRemoteBranch tracked(@NotNull Project project, @NotNull VirtualFile root, @NotNull String branchName) throws VcsException {
final HashMap<String, String> result = new HashMap<>();
GitConfigUtil.getValues(project, root, null, result);
String remoteName = result.get(trackedRemoteKey(branchName));
if (remoteName == null) {
return null;
}
String branch = result.get(trackedBranchKey(branchName));
if (branch == null) {
return null;
}
if (".".equals(remoteName)) {
return new GitSvnRemoteBranch(branch);
}
GitRemote remote = findRemoteByNameOrLogError(project, root, remoteName);
if (remote == null)
return null;
return new GitStandardRemoteBranch(remote, branch);
}
Aggregations