Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Sohn2015-02-24 14:18:46 +0000
committerMatthias Sohn2015-02-26 10:15:08 +0000
commitc894996fb6177a4868456e84bf248ed8bd24773f (patch)
tree8a1345374ad4b725fb96481a10f076eb0740b243 /org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/clone
parentc69e35d50c163f62ed8ca1d537206f7e086a272e (diff)
downloadegit-c894996fb6177a4868456e84bf248ed8bd24773f.tar.gz
egit-c894996fb6177a4868456e84bf248ed8bd24773f.tar.xz
egit-c894996fb6177a4868456e84bf248ed8bd24773f.zip
Auto-configure Gerrit configuration if repository is cloned from Gerrit
If a repository is cloned over http or https protocol use Gerrit's REST API endpoint "Get Version" [1] to find out if the repository is hosted by a Gerrit server. Implement a shortcut for https and ssh endpoint of the Eclipse Gerrit server. If we detect the repository was cloned from a Gerrit server auto configure the repository for Gerrit. Configure the push refspec to HEAD:refs/for/master which should be ok in most cases. [1] https://gerrit-documentation.storage.googleapis.com/Documentation/2.11/rest-api-config.html#get-version Bug: 460423 Change-Id: I30b916e279e0bc84f86abbffae241f8aab3fa8df Signed-off-by: Matthias Sohn <matthias.sohn@sap.com> Also-by: Andrey Loskutov <loskutov@gmx.de>
Diffstat (limited to 'org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/clone')
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/clone/AbstractGitCloneWizard.java9
1 files changed, 9 insertions, 0 deletions
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/clone/AbstractGitCloneWizard.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/clone/AbstractGitCloneWizard.java
index 10909c9c44..29ac089a04 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/clone/AbstractGitCloneWizard.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/clone/AbstractGitCloneWizard.java
@@ -36,6 +36,7 @@ import org.eclipse.egit.core.internal.util.ProjectUtil;
import org.eclipse.egit.core.op.CloneOperation;
import org.eclipse.egit.core.op.CloneOperation.PostCloneTask;
import org.eclipse.egit.core.op.ConfigureFetchAfterCloneTask;
+import org.eclipse.egit.core.op.ConfigureGerritAfterCloneTask;
import org.eclipse.egit.core.op.ConfigurePushAfterCloneTask;
import org.eclipse.egit.core.op.SetRepositoryConfigPropertyTask;
import org.eclipse.egit.core.securestorage.UserPasswordCredentials;
@@ -254,6 +255,7 @@ public abstract class AbstractGitCloneWizard extends Wizard {
configureFetchSpec(op, gitRepositoryInfo, remoteName);
configurePush(op, gitRepositoryInfo, remoteName);
configureRepositoryConfig(op, gitRepositoryInfo);
+ configureGerrit(op, gitRepositoryInfo, remoteName, timeout);
if (cloneDestination.isImportProjects()) {
final IWorkingSet[] sets = cloneDestination.getWorkingSets();
@@ -345,6 +347,13 @@ public abstract class AbstractGitCloneWizard extends Wizard {
}
}
+ private void configureGerrit(CloneOperation op,
+ GitRepositoryInfo gitRepositoryInfo, String remoteName, int timeout) {
+ ConfigureGerritAfterCloneTask task = new ConfigureGerritAfterCloneTask(
+ gitRepositoryInfo.getCloneUri(), remoteName, timeout);
+ op.addPostCloneTask(task);
+ }
+
private void importProjects(final Repository repository,
final IWorkingSet[] sets) {
String repoName = Activator.getDefault().getRepositoryUtil()

Back to the top