IDEA-96100 GitHub: set tracked branch on sharing unversioned project

This commit is contained in:
Aleksey Pivovarov
2013-07-03 16:49:26 +04:00
parent 649f8bab36
commit e2d304c063
4 changed files with 23 additions and 2 deletions
@@ -92,6 +92,10 @@ public interface Git {
@NotNull
GitCommandResult tip(@NotNull GitRepository repository, @NotNull String branchName);
@NotNull
GitCommandResult push(@NotNull GitRepository repository, @NotNull String remote, @NotNull String url, @NotNull String spec,
boolean updateTracking, @NotNull GitLineHandlerListener... listeners);
@NotNull
GitCommandResult push(@NotNull GitRepository repository, @NotNull String remote, @NotNull String url, @NotNull String spec,
@NotNull GitLineHandlerListener... listeners);
@@ -357,7 +357,7 @@ public class GitImpl implements Git {
@Override
@NotNull
public GitCommandResult push(@NotNull GitRepository repository, @NotNull String remote, @NotNull String url, @NotNull String spec,
@NotNull GitLineHandlerListener... listeners) {
boolean updateTracking, @NotNull GitLineHandlerListener... listeners) {
final GitLineHandlerPasswordRequestAware h = new GitLineHandlerPasswordRequestAware(repository.getProject(), repository.getRoot(),
GitCommand.PUSH);
h.setUrl(url);
@@ -366,9 +366,19 @@ public class GitImpl implements Git {
h.addProgressParameter();
h.addParameters(remote);
h.addParameters(spec);
if (updateTracking) {
h.addParameters("--set-upstream");
}
return run(h);
}
@Override
@NotNull
public GitCommandResult push(@NotNull GitRepository repository, @NotNull String remote, @NotNull String url, @NotNull String spec,
@NotNull GitLineHandlerListener... listeners) {
return push(repository, remote, url, spec, false, listeners);
}
@Override
@NotNull
public GitCommandResult push(@NotNull GitRepository repository, @NotNull GitPushSpec pushSpec, @NotNull String url,
@@ -188,6 +188,13 @@ public class GitTestImpl implements Git {
return execute(repository, "rev-list -1 " + branchName);
}
@NotNull
@Override
public GitCommandResult push(@NotNull GitRepository repository, @NotNull String remote, @NotNull String url, @NotNull String spec,
boolean updateTracking, @NotNull GitLineHandlerListener... listeners) {
throw new UnsupportedOperationException();
}
@NotNull
@Override
public GitCommandResult push(@NotNull GitRepository repository, @NotNull String remote, @NotNull String url, @NotNull String spec,
@@ -375,7 +375,7 @@ public class GithubShareAction extends DumbAwareAction {
"no current branch");
return false;
}
GitCommandResult result = git.push(repository, remoteName, remoteUrl, currentBranch.getName());
GitCommandResult result = git.push(repository, remoteName, remoteUrl, currentBranch.getName(), true);
if (!result.success()) {
GithubNotifications.showError(project, "Can't finish GitHub sharing process", "Successfully created project '" +
name +