Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Sohn2012-02-13 02:50:46 -0500
committerMatthias Sohn2012-02-13 02:51:02 -0500
commitddd9538196c73a085f66cb6d530b176488808117 (patch)
treed35a69de1655e3f02bab299f55644ffdb6d6a0ee
parenta0495246dbf4a51a3b29fd182b060be9043f3e7a (diff)
parent31ba4aa086c07394d61484b285d099cd5133e13c (diff)
downloadegit-github-ddd9538196c73a085f66cb6d530b176488808117.tar.gz
egit-github-ddd9538196c73a085f66cb6d530b176488808117.tar.xz
egit-github-ddd9538196c73a085f66cb6d530b176488808117.zip
Merge branch 'stable-1.3'
* stable-1.3: Prepare post 1.3.0.201202121842-rc4 builds EGit GitHub 1.3.0.201202121842-rc4 Support editing specific repository fields only Update build to use the Indigo SR2 orbit repository Add the RepositorySearchWizardPage to the EGit import wizard Update .eclipse_iplog for 1.3.0 Change-Id: Ieba2b3364bcd2f01abef559c5eead6ac68d27f01 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
-rw-r--r--.eclipse_iplog7
-rw-r--r--org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/RepositoryServiceTest.java50
-rw-r--r--org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/service/RepositoryService.java43
-rw-r--r--org.eclipse.mylyn.github.ui/META-INF/MANIFEST.MF1
-rw-r--r--org.eclipse.mylyn.github.ui/plugin.xml11
-rw-r--r--[-rwxr-xr-x]org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/internal/github/ui/RepositorySearchWizardPage.java26
-rw-r--r--pom.xml2
7 files changed, 130 insertions, 10 deletions
diff --git a/.eclipse_iplog b/.eclipse_iplog
index b771304e..7fedb456 100644
--- a/.eclipse_iplog
+++ b/.eclipse_iplog
@@ -7,11 +7,6 @@
[consumes "technology.jgit"]
name = JGit
- version = 1.2.0
+ version = 1.3.0
license = Eclipse Distribution License v1.0
-[CQ "5162"]
- description = jakarta-httpclient-4.1 (PB Orbit CQ4840)
- license = Apache License, 2.0
- use = unmodified source & binary
- state = approved
diff --git a/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/RepositoryServiceTest.java b/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/RepositoryServiceTest.java
index 46cab454..8e66be6b 100644
--- a/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/RepositoryServiceTest.java
+++ b/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/RepositoryServiceTest.java
@@ -17,6 +17,8 @@ import static org.mockito.Mockito.verify;
import java.io.IOException;
import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
import org.eclipse.egit.github.core.Repository;
import org.eclipse.egit.github.core.RepositoryHook;
@@ -117,6 +119,54 @@ public class RepositoryServiceTest {
}
/**
+ * Edit repository with fields
+ *
+ * @throws IOException
+ */
+ @Test(expected = IllegalArgumentException.class)
+ public void editRepositoryWithNullFields() throws IOException {
+ service.editRepository("o", "n", null);
+ }
+
+ /**
+ * Edit repository with fields
+ *
+ * @throws IOException
+ */
+ @Test
+ public void editRepositoryWithFields() throws IOException {
+ Map<String, Object> fields = new HashMap<String, Object>();
+ fields.put("has_issues", true);
+ fields.put("homepage", "test://address");
+ service.editRepository("o", "n", fields);
+ verify(client).post("/repos/o/n", fields, Repository.class);
+ }
+
+ /**
+ * Edit repository with fields
+ *
+ * @throws IOException
+ */
+ @Test(expected = IllegalArgumentException.class)
+ public void editRepositoryProviderWithNullFields() throws IOException {
+ service.editRepository(repo, null);
+ }
+
+ /**
+ * Edit repository with fields
+ *
+ * @throws IOException
+ */
+ @Test
+ public void editRepositoryProviderWithFields() throws IOException {
+ Map<String, Object> fields = new HashMap<String, Object>();
+ fields.put("has_issues", true);
+ fields.put("homepage", "test://address");
+ service.editRepository(repo, fields);
+ verify(client).post("/repos/o/n", fields, Repository.class);
+ }
+
+ /**
* Create repository with null organization name
*
* @throws IOException
diff --git a/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/service/RepositoryService.java b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/service/RepositoryService.java
index e35cf5f2..7e9dae70 100644
--- a/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/service/RepositoryService.java
+++ b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/service/RepositoryService.java
@@ -700,6 +700,49 @@ public class RepositoryService extends GitHubService {
}
/**
+ * Edit given fields in repository
+ * <p>
+ * Only values in the given fields map will be updated on the repository
+ *
+ * @param owner
+ * @param name
+ * @param fields
+ * @return edited repository
+ * @throws IOException
+ */
+ public Repository editRepository(String owner, String name,
+ Map<String, Object> fields) throws IOException {
+ verifyRepository(owner, name);
+ if (fields == null)
+ throw new IllegalArgumentException("Fields cannot be null"); //$NON-NLS-1$
+
+ StringBuilder uri = new StringBuilder(SEGMENT_REPOS);
+ uri.append('/').append(owner).append('/').append(name);
+ return client.post(uri.toString(), fields, Repository.class);
+ }
+
+ /**
+ * Edit given fields in repository
+ * <p>
+ * Only values in the given fields map will be updated on the repository
+ *
+ * @param provider
+ * @param fields
+ * @return edited repository
+ * @throws IOException
+ */
+ public Repository editRepository(IRepositoryIdProvider provider,
+ Map<String, Object> fields) throws IOException {
+ String id = getId(provider);
+ if (fields == null)
+ throw new IllegalArgumentException("Fields cannot be null"); //$NON-NLS-1$
+
+ StringBuilder uri = new StringBuilder(SEGMENT_REPOS);
+ uri.append('/').append(id);
+ return client.post(uri.toString(), fields, Repository.class);
+ }
+
+ /**
* Fork given repository into new repository under the currently
* authenticated user.
*
diff --git a/org.eclipse.mylyn.github.ui/META-INF/MANIFEST.MF b/org.eclipse.mylyn.github.ui/META-INF/MANIFEST.MF
index e9f08270..4a22e8ea 100644
--- a/org.eclipse.mylyn.github.ui/META-INF/MANIFEST.MF
+++ b/org.eclipse.mylyn.github.ui/META-INF/MANIFEST.MF
@@ -36,6 +36,7 @@ Import-Package: org.eclipse.egit.core;version="[1.3.0,1.4.0)",
org.eclipse.egit.ui.internal.branch;version="[1.3.0,1.4.0)",
org.eclipse.egit.ui.internal.commit;version="[1.3.0,1.4.0)",
org.eclipse.egit.ui.internal.fetch;version="[1.3.0,1.4.0)",
+ org.eclipse.egit.ui.internal.provisional.wizards;version="[1.3.0,1.4.0)",
org.eclipse.egit.ui.internal.pull;version="[1.3.0,1.4.0)",
org.eclipse.jgit.errors;version="[1.3.0,1.4.0)",
org.eclipse.jgit.lib;version="[1.3.0,1.4.0)",
diff --git a/org.eclipse.mylyn.github.ui/plugin.xml b/org.eclipse.mylyn.github.ui/plugin.xml
index 2dd024ea..724ec315 100644
--- a/org.eclipse.mylyn.github.ui/plugin.xml
+++ b/org.eclipse.mylyn.github.ui/plugin.xml
@@ -295,4 +295,15 @@
icon="platform:/plugin/org.eclipse.egit.ui/icons/obj16/rebase.gif">
</image>
</extension>
+ <extension
+ point="org.eclipse.egit.ui.cloneSourceProvider">
+ <source
+ hasFixLocation="true"
+ icon="icons/obj16/github.png"
+ label="%githubMenuLabel">
+ </source>
+ <repositorySearchPage
+ class="org.eclipse.mylyn.internal.github.ui.RepositorySearchWizardPage">
+ </repositorySearchPage>
+ </extension>
</plugin>
diff --git a/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/internal/github/ui/RepositorySearchWizardPage.java b/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/internal/github/ui/RepositorySearchWizardPage.java
index 7fae81f4..fe92cf35 100755..100644
--- a/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/internal/github/ui/RepositorySearchWizardPage.java
+++ b/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/internal/github/ui/RepositorySearchWizardPage.java
@@ -18,12 +18,16 @@ import java.util.List;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.egit.github.core.Language;
+import org.eclipse.egit.github.core.Repository;
import org.eclipse.egit.github.core.SearchRepository;
import org.eclipse.egit.github.core.client.GitHubClient;
import org.eclipse.egit.github.core.client.IGitHubConstants;
import org.eclipse.egit.github.core.service.RepositoryService;
import org.eclipse.egit.github.core.util.UrlUtils;
import org.eclipse.egit.ui.UIIcons;
+import org.eclipse.egit.ui.internal.provisional.wizards.GitRepositoryInfo;
+import org.eclipse.egit.ui.internal.provisional.wizards.IRepositorySearchResult;
+import org.eclipse.egit.ui.internal.provisional.wizards.NoRepositoryInfoException;
import org.eclipse.jface.layout.GridDataFactory;
import org.eclipse.jface.layout.GridLayoutFactory;
import org.eclipse.jface.operation.IRunnableWithProgress;
@@ -39,6 +43,7 @@ import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.StyledString;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.mylyn.internal.github.core.GitHub;
import org.eclipse.mylyn.internal.github.core.GitHubException;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent;
@@ -56,7 +61,8 @@ import org.eclipse.ui.PlatformUI;
/**
* Search for GitHub repositories wizard page.
*/
-public class RepositorySearchWizardPage extends WizardPage {
+@SuppressWarnings("restriction")
+public class RepositorySearchWizardPage extends WizardPage implements IRepositorySearchResult {
private SearchRepository[] repositories = null;
@@ -69,9 +75,9 @@ public class RepositorySearchWizardPage extends WizardPage {
private Text searchText;
/**
- *
+ *
*/
- protected RepositorySearchWizardPage() {
+ public RepositorySearchWizardPage() {
super("repoSearchPage", Messages.RepositorySearchWizardPage_Title, null); //$NON-NLS-1$
setDescription(Messages.RepositorySearchWizardPage_Description);
setPageComplete(false);
@@ -285,4 +291,18 @@ public class RepositorySearchWizardPage extends WizardPage {
GitHubUi.logError(e);
}
}
+
+ public GitRepositoryInfo getGitRepositoryInfo() throws NoRepositoryInfoException {
+ GitHubClient client = GitHub
+ .configureClient(new GitHubClient());
+ RepositoryService service = new RepositoryService(client);
+ String cloneUrl = null;
+ try {
+ Repository fullRepo = service.getRepository(repositories[0]);
+ cloneUrl = fullRepo.getCloneUrl();
+ } catch (IOException e) {
+ throw new NoRepositoryInfoException(e.getMessage(), e);
+ }
+ return new GitRepositoryInfo(cloneUrl);
+ }
}
diff --git a/pom.xml b/pom.xml
index b80f1cf7..7f0fb6ea 100644
--- a/pom.xml
+++ b/pom.xml
@@ -45,7 +45,7 @@
<platform-version-name>indigo</platform-version-name>
<wikitext-site>http://download.eclipse.org/tools/mylyn/update/weekly</wikitext-site>
<eclipse-site>http://download.eclipse.org/releases/${platform-version-name}</eclipse-site>
- <orbit-site>http://download.eclipse.org/tools/orbit/downloads/drops/R20110523182458/repository</orbit-site>
+ <orbit-site>http://download.eclipse.org/tools/orbit/downloads/drops/R20120119162704/repository</orbit-site>
<download-publish-path>/home/data/httpd/download.eclipse.org/egit/github/updates-nightly</download-publish-path>
</properties>

Back to the top