Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Sohn2012-06-14 00:06:05 +0000
committerMatthias Sohn2012-06-14 00:06:22 +0000
commit44ece8b2c5ec239f6c5c8d0519384ab9c0f36934 (patch)
treea8c6d1c6da3b6881b8c790fcde11d9bac5fe9b09
parent3ef0763049f682ceb0f1d6d256a0e7dd80a2982b (diff)
parentb83d6d15f45ea7372394d646a6dec8d8500eda9f (diff)
downloadegit-github-44ece8b2c5ec239f6c5c8d0519384ab9c0f36934.tar.gz
egit-github-44ece8b2c5ec239f6c5c8d0519384ab9c0f36934.tar.xz
egit-github-44ece8b2c5ec239f6c5c8d0519384ab9c0f36934.zip
Merge branch 'stable-2.0'
* stable-2.0: Prepare post 2.0.0.201206130900-r builds EGit Github Mylyn Connector 2.0.0.201206130900-r Fix typo in p2repo-zip-path Fix paths for signing plugin Update build to use official Juno Orbit repository Explicitly configure Tycho target runtime environment Update build to use Tycho 0.15.0 Add legacy support for searching issues Suppress parse exceptions deserializing event payloads Use API v3 endpoint for repository search API Prepare next 2.0.0-SNAPSHOT builds EGit Github Mylyn Connector v2.0.0.201206060730-rc3 Prepare next 2.0.0-SNAPSHOT builds EGit GitHub Connector v2.0.0.201205301645-rc2 Fix relative path to EGit p2 repository for local build Change-Id: Ieb71364a91a0c39c19869c76d6eb2480b9df080c Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
-rw-r--r--org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/AllHeadlessTests.java1
-rw-r--r--org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/GitHubClientTest.java14
-rw-r--r--org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/IssueServiceTest.java84
-rw-r--r--org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/RepositoryServiceTest.java10
-rw-r--r--org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/SearchIssueTest.java73
-rw-r--r--org.eclipse.egit.github.core/META-INF/SOURCE-MANIFEST.MF2
-rw-r--r--org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/SearchIssue.java259
-rw-r--r--org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/client/EventFormatter.java12
-rw-r--r--org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/client/GitHubClient.java10
-rw-r--r--org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/client/IGitHubConstants.java8
-rw-r--r--org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/service/IssueService.java56
-rw-r--r--org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/service/RepositoryService.java25
-rw-r--r--org.eclipse.mylyn.github-site/pom.xml13
-rw-r--r--org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/internal/github/ui/RepositorySearchWizardPage.java27
-rw-r--r--pom.xml40
15 files changed, 553 insertions, 81 deletions
diff --git a/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/AllHeadlessTests.java b/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/AllHeadlessTests.java
index c1509c1c..5d50e1fd 100644
--- a/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/AllHeadlessTests.java
+++ b/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/AllHeadlessTests.java
@@ -86,6 +86,7 @@ import org.junit.runners.Suite.SuiteClasses;
RepositoryTest.class, //
RequestErrorTest.class, //
RequestExceptionTest.class, //
+ SearchIssueTest.class, //
SearchRepositoryTest.class, //
ShaResourceTest.class, //
TagTest.class, //
diff --git a/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/GitHubClientTest.java b/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/GitHubClientTest.java
index 17e29140..f0a2e379 100644
--- a/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/GitHubClientTest.java
+++ b/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/GitHubClientTest.java
@@ -33,18 +33,6 @@ public class GitHubClientTest {
}
/**
- * Verify prefix with API v2 host
- */
- @Test
- public void prefixHostApiV2() {
- PrefixClient client = new PrefixClient(IGitHubConstants.HOST_API_V2);
- assertEquals("/api/v3/repos/o/n", client.uri("/api/v3/repos/o/n"));
- assertEquals("/repos/o/n", client.uri("/repos/o/n"));
- assertEquals("/api/v2/json/repos/search/test",
- client.uri("/api/v2/json/repos/search/test"));
- }
-
- /**
* Verify prefix with API v3 host
*/
@Test
@@ -64,7 +52,5 @@ public class GitHubClientTest {
PrefixClient client = new PrefixClient("localhost");
assertEquals("/api/v3/repos/o/n", client.uri("/repos/o/n"));
assertEquals("/api/v3/repos/o/n", client.uri("/api/v3/repos/o/n"));
- assertEquals("/api/v2/json/repos/search/test",
- client.uri("/api/v2/json/repos/search/test"));
}
}
diff --git a/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/IssueServiceTest.java b/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/IssueServiceTest.java
index b249c226..17b9f816 100644
--- a/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/IssueServiceTest.java
+++ b/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/IssueServiceTest.java
@@ -830,4 +830,88 @@ public class IssueServiceTest {
verify(gitHubClient).post("/repos/user/repo/issues/comments/44",
comment, Comment.class);
}
+
+ /**
+ * Search issues with null repository
+ *
+ * @throws IOException
+ */
+ @Test(expected = IllegalArgumentException.class)
+ public void searchIssuesNullRepository() throws IOException {
+ issueService.searchIssues(null, "open", "test");
+ }
+
+ /**
+ * Search issues with null query
+ *
+ * @throws IOException
+ */
+ @Test(expected = IllegalArgumentException.class)
+ public void searchIssueNullQuery() throws IOException {
+ RepositoryId id = new RepositoryId("user", "repo");
+ issueService.searchIssues(id, "open", null);
+ }
+
+ /**
+ * Search issues with empty query
+ *
+ * @throws IOException
+ */
+ @Test(expected = IllegalArgumentException.class)
+ public void searchIssueEmptyQuery() throws IOException {
+ RepositoryId id = new RepositoryId("user", "repo");
+ issueService.searchIssues(id, "open", "");
+ }
+
+ /**
+ * Search issues with null state
+ *
+ * @throws IOException
+ */
+ @Test(expected = IllegalArgumentException.class)
+ public void searchIssueNullState() throws IOException {
+ RepositoryId id = new RepositoryId("user", "repo");
+ issueService.searchIssues(id, null, "test");
+ }
+
+ /**
+ * Search issues with empty state
+ *
+ * @throws IOException
+ */
+ @Test(expected = IllegalArgumentException.class)
+ public void searchIssueEmptyState() throws IOException {
+ RepositoryId id = new RepositoryId("user", "repo");
+ issueService.searchIssues(id, "", "test");
+ }
+
+ /**
+ * Search issues
+ *
+ * @throws IOException
+ */
+ @Test
+ public void searchIssues() throws IOException {
+ RepositoryId id = new RepositoryId("user", "repo");
+ issueService.searchIssues(id, "closed", "test");
+ GitHubRequest request = new GitHubRequest();
+ request.setUri(Utils
+ .page("/legacy/issues/search/user/repo/closed/test"));
+ verify(gitHubClient).get(request);
+ }
+
+ /**
+ * Search issues with query that needs escaping
+ *
+ * @throws IOException
+ */
+ @Test
+ public void searchEscaped() throws IOException {
+ RepositoryId id = new RepositoryId("user", "repo");
+ issueService.searchIssues(id, "open", "a and a.");
+ GitHubRequest request = new GitHubRequest();
+ request.setUri(Utils
+ .page("/legacy/issues/search/user/repo/open/a%20and%20a%2E"));
+ verify(gitHubClient).get(request);
+ }
}
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 d60c3ef3..d4b76d25 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
@@ -379,7 +379,7 @@ public class RepositoryServiceTest {
public void searchRepositories() throws IOException {
service.searchRepositories("test");
GitHubRequest request = new GitHubRequest();
- request.setUri(Utils.page("/api/v2/json/repos/search/test"));
+ request.setUri(Utils.page("/legacy/repos/search/test"));
verify(client).get(request);
}
@@ -392,8 +392,7 @@ public class RepositoryServiceTest {
public void searchRepositoriesMatchingLanguage() throws IOException {
service.searchRepositories("buffers", "c");
GitHubRequest request = new GitHubRequest();
- request.setUri(Utils
- .page("/api/v2/json/repos/search/buffers?language=c"));
+ request.setUri(Utils.page("/legacy/repos/search/buffers?language=c"));
verify(client).get(request);
}
@@ -406,8 +405,7 @@ public class RepositoryServiceTest {
public void searchRepositoriesStartingAtPage() throws IOException {
service.searchRepositories("buffers", 50);
GitHubRequest request = new GitHubRequest();
- request.setUri(Utils
- .page("/api/v2/json/repos/search/buffers?start_page=50"));
+ request.setUri(Utils.page("/legacy/repos/search/buffers?start_page=50"));
verify(client).get(request);
}
@@ -420,7 +418,7 @@ public class RepositoryServiceTest {
public void searchEscaped() throws IOException {
service.searchRepositories("a and a.");
GitHubRequest request = new GitHubRequest();
- request.setUri(Utils.page("/api/v2/json/repos/search/a%20and%20a%2E"));
+ request.setUri(Utils.page("/legacy/repos/search/a%20and%20a%2E"));
verify(client).get(request);
}
diff --git a/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/SearchIssueTest.java b/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/SearchIssueTest.java
new file mode 100644
index 00000000..a7f8b1f6
--- /dev/null
+++ b/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/SearchIssueTest.java
@@ -0,0 +1,73 @@
+/******************************************************************************
+ * Copyright (c) 2012 GitHub Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Kevin Sawicki (GitHub Inc.) - initial API and implementation
+ *****************************************************************************/
+package org.eclipse.egit.github.core.tests;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+
+import java.util.Arrays;
+import java.util.Date;
+import java.util.List;
+
+import org.eclipse.egit.github.core.SearchIssue;
+import org.junit.Test;
+
+/**
+ * Unit tests of {@link SearchIssue}
+ */
+public class SearchIssueTest {
+
+ /**
+ * Test default state of search issue
+ */
+ @Test
+ public void defaultState() {
+ SearchIssue issue = new SearchIssue();
+ assertNull(issue.getBody());
+ assertNull(issue.getCreatedAt());
+ assertNull(issue.getGravatarId());
+ assertNull(issue.getHtmlUrl());
+ assertNull(issue.getLabels());
+ assertEquals(0, issue.getComments());
+ assertEquals(0, issue.getPosition());
+ assertNull(issue.getState());
+ assertNull(issue.getTitle());
+ assertNull(issue.getUpdatedAt());
+ assertNull(issue.getUser());
+ assertEquals(0, issue.getVotes());
+ assertEquals(0, issue.getNumber());
+ }
+
+ /**
+ * Test updating search issue fields
+ */
+ @Test
+ public void updateFields() {
+ SearchIssue issue = new SearchIssue();
+ assertEquals("body", issue.setBody("body").getBody());
+ assertEquals(new Date(1234), issue.setCreatedAt(new Date(1234))
+ .getCreatedAt());
+ assertEquals("gravatar", issue.setGravatarId("gravatar")
+ .getGravatarId());
+ assertEquals("html", issue.setHtmlUrl("html").getHtmlUrl());
+ List<String> labels = Arrays.asList("a", "b");
+ assertEquals(labels, issue.setLabels(labels).getLabels());
+ assertEquals(5, issue.setComments(5).getComments());
+ assertEquals(6, issue.setPosition(6).getPosition());
+ assertEquals("open", issue.setState("open").getState());
+ assertEquals("title", issue.setTitle("title").getTitle());
+ assertEquals(new Date(2345), issue.setUpdatedAt(new Date(2345))
+ .getUpdatedAt());
+ assertEquals("defunkt", issue.setUser("defunkt").getUser());
+ assertEquals(10, issue.setVotes(10).getVotes());
+ assertEquals(500, issue.setNumber(500).getNumber());
+ }
+}
diff --git a/org.eclipse.egit.github.core/META-INF/SOURCE-MANIFEST.MF b/org.eclipse.egit.github.core/META-INF/SOURCE-MANIFEST.MF
index 9e81c482..e2c2a79d 100644
--- a/org.eclipse.egit.github.core/META-INF/SOURCE-MANIFEST.MF
+++ b/org.eclipse.egit.github.core/META-INF/SOURCE-MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: EGit GitHub API Core
Bundle-SymbolicName: org.eclipse.egit.github.core
-Bundle-Version: 1.1.0.qualifier
+Bundle-Version: 2.0.0.qualifier
Bundle-Vendor: Eclipse EGit
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Import-Package: com.google.gson;version="[1.6.0,2.0.0)",
diff --git a/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/SearchIssue.java b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/SearchIssue.java
new file mode 100644
index 00000000..133ce835
--- /dev/null
+++ b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/SearchIssue.java
@@ -0,0 +1,259 @@
+/******************************************************************************
+ * Copyright (c) 2012 GitHub Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Kevin Sawicki (GitHub Inc.) - initial API and implementation
+ *****************************************************************************/
+package org.eclipse.egit.github.core;
+
+import java.io.Serializable;
+import java.util.Date;
+import java.util.List;
+
+import org.eclipse.egit.github.core.util.DateUtils;
+
+/**
+ * GitHub v2 issue model class.
+ */
+public class SearchIssue implements Serializable {
+
+ private static final long serialVersionUID = 4853048031771824016L;
+
+ private Date createdAt;
+
+ private Date updatedAt;
+
+ private int comments;
+
+ private int number;
+
+ private int position;
+
+ private int votes;
+
+ private List<String> labels;
+
+ private String body;
+
+ private String gravatarId;
+
+ private String htmlUrl;
+
+ private String state;
+
+ private String title;
+
+ private String user;
+
+ /**
+ * @return createdAt
+ */
+ public Date getCreatedAt() {
+ return DateUtils.clone(createdAt);
+ }
+
+ /**
+ * @param createdAt
+ * @return this issue
+ */
+ public SearchIssue setCreatedAt(Date createdAt) {
+ this.createdAt = DateUtils.clone(createdAt);
+ return this;
+ }
+
+ /**
+ * @return updatedAt
+ */
+ public Date getUpdatedAt() {
+ return DateUtils.clone(updatedAt);
+ }
+
+ /**
+ * @param updatedAt
+ * @return this issue
+ */
+ public SearchIssue setUpdatedAt(Date updatedAt) {
+ this.updatedAt = DateUtils.clone(updatedAt);
+ return this;
+ }
+
+ /**
+ * @return comments
+ */
+ public int getComments() {
+ return comments;
+ }
+
+ /**
+ * @param comments
+ * @return this issue
+ */
+ public SearchIssue setComments(int comments) {
+ this.comments = comments;
+ return this;
+ }
+
+ /**
+ * @return number
+ */
+ public int getNumber() {
+ return number;
+ }
+
+ /**
+ * @param number
+ * @return this issue
+ */
+ public SearchIssue setNumber(int number) {
+ this.number = number;
+ return this;
+ }
+
+ /**
+ * @return position
+ */
+ public int getPosition() {
+ return position;
+ }
+
+ /**
+ * @param position
+ * @return this issue
+ */
+ public SearchIssue setPosition(int position) {
+ this.position = position;
+ return this;
+ }
+
+ /**
+ * @return votes
+ */
+ public int getVotes() {
+ return votes;
+ }
+
+ /**
+ * @param votes
+ * @return this issue
+ */
+ public SearchIssue setVotes(int votes) {
+ this.votes = votes;
+ return this;
+ }
+
+ /**
+ * @return labels
+ */
+ public List<String> getLabels() {
+ return labels;
+ }
+
+ /**
+ * @param labels
+ * @return this issue
+ */
+ public SearchIssue setLabels(List<String> labels) {
+ this.labels = labels;
+ return this;
+ }
+
+ /**
+ * @return body
+ */
+ public String getBody() {
+ return body;
+ }
+
+ /**
+ * @param body
+ * @return this issue
+ */
+ public SearchIssue setBody(String body) {
+ this.body = body;
+ return this;
+ }
+
+ /**
+ * @return gravatarId
+ */
+ public String getGravatarId() {
+ return gravatarId;
+ }
+
+ /**
+ * @param gravatarId
+ * @return this issue
+ */
+ public SearchIssue setGravatarId(String gravatarId) {
+ this.gravatarId = gravatarId;
+ return this;
+ }
+
+ /**
+ * @return htmlUrl
+ */
+ public String getHtmlUrl() {
+ return htmlUrl;
+ }
+
+ /**
+ * @param htmlUrl
+ * @return this issue
+ */
+ public SearchIssue setHtmlUrl(String htmlUrl) {
+ this.htmlUrl = htmlUrl;
+ return this;
+ }
+
+ /**
+ * @return state
+ */
+ public String getState() {
+ return state;
+ }
+
+ /**
+ * @param state
+ * @return this issue
+ */
+ public SearchIssue setState(String state) {
+ this.state = state;
+ return this;
+ }
+
+ /**
+ * @return title
+ */
+ public String getTitle() {
+ return title;
+ }
+
+ /**
+ * @param title
+ * @return this issue
+ */
+ public SearchIssue setTitle(String title) {
+ this.title = title;
+ return this;
+ }
+
+ /**
+ * @return user
+ */
+ public String getUser() {
+ return user;
+ }
+
+ /**
+ * @param user
+ * @return this issue
+ */
+ public SearchIssue setUser(String user) {
+ this.user = user;
+ return this;
+ }
+}
diff --git a/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/client/EventFormatter.java b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/client/EventFormatter.java
index 8cbfb9ab..cc53bcad 100644
--- a/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/client/EventFormatter.java
+++ b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/client/EventFormatter.java
@@ -123,8 +123,14 @@ public class EventFormatter implements JsonDeserializer<Event> {
else
return event;
- EventPayload typedPayload = context.deserialize(rawPayload,
- payloadClass);
- return event.setPayload(typedPayload);
+ try {
+ EventPayload typedPayload = context.deserialize(rawPayload,
+ payloadClass);
+ return event.setPayload(typedPayload);
+ } catch (JsonParseException jpe) {
+ // Parse exception here denotes legacy payloads with differing
+ // fields than built-in payload classes provide
+ return event;
+ }
}
}
diff --git a/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/client/GitHubClient.java b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/client/GitHubClient.java
index 99340ea0..5e992129 100644
--- a/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/client/GitHubClient.java
+++ b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/client/GitHubClient.java
@@ -26,11 +26,9 @@ import static org.eclipse.egit.github.core.client.IGitHubConstants.AUTH_TOKEN;
import static org.eclipse.egit.github.core.client.IGitHubConstants.CHARSET_UTF8;
import static org.eclipse.egit.github.core.client.IGitHubConstants.CONTENT_TYPE_JSON;
import static org.eclipse.egit.github.core.client.IGitHubConstants.HOST_API;
-import static org.eclipse.egit.github.core.client.IGitHubConstants.HOST_API_V2;
import static org.eclipse.egit.github.core.client.IGitHubConstants.HOST_DEFAULT;
import static org.eclipse.egit.github.core.client.IGitHubConstants.HOST_GISTS;
import static org.eclipse.egit.github.core.client.IGitHubConstants.PROTOCOL_HTTPS;
-import static org.eclipse.egit.github.core.client.IGitHubConstants.SEGMENT_V2_API;
import static org.eclipse.egit.github.core.client.IGitHubConstants.SEGMENT_V3_API;
import com.google.gson.Gson;
@@ -184,7 +182,7 @@ public class GitHubClient {
baseUri = uri.toString();
// Use URI prefix on non-standard host names
- if (HOST_API.equals(hostname) || HOST_API_V2.equals(hostname))
+ if (HOST_API.equals(hostname))
prefix = null;
else
prefix = SEGMENT_V3_API;
@@ -239,10 +237,10 @@ public class GitHubClient {
* @return configured URI
*/
protected String configureUri(final String uri) {
- if (prefix == null || uri.startsWith(SEGMENT_V2_API)
- || uri.startsWith(prefix))
+ if (prefix == null || uri.startsWith(prefix))
return uri;
- return prefix + uri;
+ else
+ return prefix + uri;
}
/**
diff --git a/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/client/IGitHubConstants.java b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/client/IGitHubConstants.java
index 575a5ca9..62cabd83 100644
--- a/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/client/IGitHubConstants.java
+++ b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/client/IGitHubConstants.java
@@ -42,8 +42,6 @@ public interface IGitHubConstants {
/** */
String HOST_API = "api.github.com"; //$NON-NLS-1$
/** */
- String HOST_API_V2 = "github.com"; //$NON-NLS-1$
- /** */
String HOST_DEFAULT = "github.com"; //$NON-NLS-1$
/** */
String HOST_GISTS = "gist.github.com"; //$NON-NLS-1$
@@ -121,6 +119,8 @@ public interface IGitHubConstants {
/** */
String SEGMENT_LABELS = "/labels"; //$NON-NLS-1$
/** */
+ String SEGMENT_LEGACY = "/legacy"; //$NON-NLS-1$
+ /** */
String SEGMENT_LANGUAGES = "/languages"; //$NON-NLS-1$
/** */
String SEGMENT_MEMBERS = "/members"; //$NON-NLS-1$
@@ -173,8 +173,6 @@ public interface IGitHubConstants {
/** */
String SEGMENT_WATCHERS = "/watchers"; //$NON-NLS-1$
/** */
- String SEGMENT_V2_API = "/api/v2/json"; //$NON-NLS-1$
- /** */
String SEGMENT_V3_API = "/api/v3"; //$NON-NLS-1$
/** */
@@ -185,6 +183,4 @@ public interface IGitHubConstants {
/** */
String URL_API = PROTOCOL_HTTPS + "://" + HOST_API; //$NON-NLS-1$
- /** */
- String URL_API_V2 = PROTOCOL_HTTPS + "://" + HOST_API_V2; //$NON-NLS-1$
}
diff --git a/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/service/IssueService.java b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/service/IssueService.java
index 71888ecf..c4e137d8 100644
--- a/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/service/IssueService.java
+++ b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/service/IssueService.java
@@ -10,16 +10,20 @@
*******************************************************************************/
package org.eclipse.egit.github.core.service;
+import static org.eclipse.egit.github.core.client.IGitHubConstants.CHARSET_UTF8;
import static org.eclipse.egit.github.core.client.IGitHubConstants.SEGMENT_COMMENTS;
import static org.eclipse.egit.github.core.client.IGitHubConstants.SEGMENT_EVENTS;
import static org.eclipse.egit.github.core.client.IGitHubConstants.SEGMENT_ISSUES;
+import static org.eclipse.egit.github.core.client.IGitHubConstants.SEGMENT_LEGACY;
import static org.eclipse.egit.github.core.client.IGitHubConstants.SEGMENT_REPOS;
+import static org.eclipse.egit.github.core.client.IGitHubConstants.SEGMENT_SEARCH;
import static org.eclipse.egit.github.core.client.PagedRequest.PAGE_FIRST;
import static org.eclipse.egit.github.core.client.PagedRequest.PAGE_SIZE;
import com.google.gson.reflect.TypeToken;
import java.io.IOException;
+import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -27,11 +31,13 @@ import java.util.Map;
import org.eclipse.egit.github.core.Comment;
import org.eclipse.egit.github.core.IRepositoryIdProvider;
+import org.eclipse.egit.github.core.IResourceProvider;
import org.eclipse.egit.github.core.Issue;
import org.eclipse.egit.github.core.IssueEvent;
import org.eclipse.egit.github.core.Label;
import org.eclipse.egit.github.core.Milestone;
import org.eclipse.egit.github.core.RepositoryIssue;
+import org.eclipse.egit.github.core.SearchIssue;
import org.eclipse.egit.github.core.User;
import org.eclipse.egit.github.core.client.GitHubClient;
import org.eclipse.egit.github.core.client.GitHubRequest;
@@ -152,6 +158,19 @@ public class IssueService extends GitHubService {
*/
public static final String SORT_COMMENTS = "comments"; //$NON-NLS-1$
+ private static class IssueContainer implements
+ IResourceProvider<SearchIssue> {
+
+ private List<SearchIssue> issues;
+
+ /**
+ * @see org.eclipse.egit.github.core.IResourceProvider#getResources()
+ */
+ public List<SearchIssue> getResources() {
+ return issues;
+ }
+ }
+
/**
* Create issue service
*/
@@ -1069,4 +1088,41 @@ public class IssueService extends GitHubService {
request.setType(IssueEvent.class);
return (IssueEvent) client.get(request).getBody();
}
+
+ /**
+ * Search issues in the given repository using the given query
+ *
+ * @param repository
+ * @param state
+ * {@link #STATE_OPEN} or {@link #STATE_CLOSED}
+ * @param query
+ * @return issues matching query
+ * @throws IOException
+ */
+ public List<SearchIssue> searchIssues(IRepositoryIdProvider repository,
+ String state, String query) throws IOException {
+ String id = getId(repository);
+ if (state == null)
+ throw new IllegalArgumentException("State cannot be null"); //$NON-NLS-1$
+ if (state.length() == 0)
+ throw new IllegalArgumentException("State cannot be empty"); //$NON-NLS-1$
+ if (query == null)
+ throw new IllegalArgumentException("Query cannot be null"); //$NON-NLS-1$
+ if (query.length() == 0)
+ throw new IllegalArgumentException("Query cannot be empty"); //$NON-NLS-1$
+
+ StringBuilder uri = new StringBuilder(SEGMENT_LEGACY + SEGMENT_ISSUES
+ + SEGMENT_SEARCH);
+ uri.append('/').append(id);
+ uri.append('/').append(state);
+ final String encodedQuery = URLEncoder.encode(query, CHARSET_UTF8)
+ .replace("+", "%20") //$NON-NLS-1$ //$NON-NLS-2$
+ .replace(".", "%2E"); //$NON-NLS-1$ //$NON-NLS-2$
+ uri.append('/').append(encodedQuery);
+
+ PagedRequest<SearchIssue> request = createPagedRequest();
+ request.setUri(uri);
+ request.setType(IssueContainer.class);
+ return getAll(request);
+ }
}
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 75817acc..d74e091c 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
@@ -18,6 +18,7 @@ import static org.eclipse.egit.github.core.client.IGitHubConstants.SEGMENT_CONTR
import static org.eclipse.egit.github.core.client.IGitHubConstants.SEGMENT_FORKS;
import static org.eclipse.egit.github.core.client.IGitHubConstants.SEGMENT_HOOKS;
import static org.eclipse.egit.github.core.client.IGitHubConstants.SEGMENT_LANGUAGES;
+import static org.eclipse.egit.github.core.client.IGitHubConstants.SEGMENT_LEGACY;
import static org.eclipse.egit.github.core.client.IGitHubConstants.SEGMENT_ORGS;
import static org.eclipse.egit.github.core.client.IGitHubConstants.SEGMENT_REPOS;
import static org.eclipse.egit.github.core.client.IGitHubConstants.SEGMENT_SEARCH;
@@ -25,7 +26,6 @@ import static org.eclipse.egit.github.core.client.IGitHubConstants.SEGMENT_TAGS;
import static org.eclipse.egit.github.core.client.IGitHubConstants.SEGMENT_TEST;
import static org.eclipse.egit.github.core.client.IGitHubConstants.SEGMENT_USER;
import static org.eclipse.egit.github.core.client.IGitHubConstants.SEGMENT_USERS;
-import static org.eclipse.egit.github.core.client.IGitHubConstants.SEGMENT_V2_API;
import static org.eclipse.egit.github.core.client.PagedRequest.PAGE_FIRST;
import static org.eclipse.egit.github.core.client.PagedRequest.PAGE_SIZE;
@@ -402,9 +402,6 @@ public class RepositoryService extends GitHubService {
/**
* Search for repositories matching query.
- * <p>
- * This method requires an API v2 configured {@link GitHubClient} as it is
- * not yet supported in API v3 clients.
*
* @param query
* @return list of repositories
@@ -417,9 +414,6 @@ public class RepositoryService extends GitHubService {
/**
* Search for repositories matching query.
- * <p>
- * This method requires an API v2 configured {@link GitHubClient} as it is
- * not yet supported in API v3 clients.
*
* @param query
* @param startPage
@@ -433,9 +427,6 @@ public class RepositoryService extends GitHubService {
/**
* Search for repositories matching language and query.
- * <p>
- * This method requires an API v2 configured {@link GitHubClient} as it is
- * not yet supported in API v3 clients.
*
* @param query
* @param language
@@ -449,9 +440,6 @@ public class RepositoryService extends GitHubService {
/**
* Search for repositories matching language and query.
- * <p>
- * This method requires an API v2 configured {@link GitHubClient} as it is
- * not yet supported in API v3 clients.
*
* @param query
* @param language
@@ -466,9 +454,8 @@ public class RepositoryService extends GitHubService {
if (query.length() == 0)
throw new IllegalArgumentException("Query cannot be empty"); //$NON-NLS-1$
- StringBuilder uri = new StringBuilder(SEGMENT_V2_API);
- uri.append(SEGMENT_REPOS);
- uri.append(SEGMENT_SEARCH);
+ StringBuilder uri = new StringBuilder(SEGMENT_LEGACY + SEGMENT_REPOS
+ + SEGMENT_SEARCH);
final String encodedQuery = URLEncoder.encode(query, CHARSET_UTF8)
.replace("+", "%20") //$NON-NLS-1$ //$NON-NLS-2$
.replace(".", "%2E"); //$NON-NLS-1$ //$NON-NLS-2$
@@ -491,9 +478,6 @@ public class RepositoryService extends GitHubService {
/**
* Search for repositories matching search parameters.
- * <p>
- * This method requires an API v2 configured {@link GitHubClient} as it is
- * not yet supported in API v3 clients.
*
* @param params
* @return list of repositories
@@ -506,9 +490,6 @@ public class RepositoryService extends GitHubService {
/**
* Search for repositories matching search parameters.
- * <p>
- * This method requires an API v2 configured {@link GitHubClient} as it is
- * not yet supported in API v3 clients.
*
* @param queryParams
* @param startPage
diff --git a/org.eclipse.mylyn.github-site/pom.xml b/org.eclipse.mylyn.github-site/pom.xml
index ec1c38a4..32b5486a 100644
--- a/org.eclipse.mylyn.github-site/pom.xml
+++ b/org.eclipse.mylyn.github-site/pom.xml
@@ -23,10 +23,15 @@
<name>Eclipse EGit Mylyn GitHub Repository</name>
+ <properties>
+ <p2repo-zip-path>${project.build.directory}/github-updatesite-${project.version}.zip</p2repo-zip-path>
+ <signer-input-directory>/home/data/httpd/download-staging.priv/egit-github</signer-input-directory>
+ </properties>
+
<build>
<plugins>
<plugin>
- <groupId>org.sonatype.tycho</groupId>
+ <groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-p2-publisher-plugin</artifactId>
<version>${tycho-version}</version>
<configuration>
@@ -47,7 +52,7 @@
<execution>
<id>pack</id>
<configuration>
- <inputFile>${project.build.directory}/github-updatesite.zip</inputFile>
+ <inputFile>${p2repo-zip-path}</inputFile>
</configuration>
<phase>package</phase>
<goals>
@@ -57,8 +62,8 @@
<execution>
<id>sign</id>
<configuration>
- <inputFile>${project.build.directory}/github-updatesite.zip</inputFile>
- <signerInputDirectory>/home/data/httpd/download-staging.priv/egit-github</signerInputDirectory>
+ <inputFile>${p2repo-zip-path}</inputFile>
+ <signerInputDirectory>${signer-input-directory}</signerInputDirectory>
</configuration>
<phase>package</phase>
<goals>
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 fe92cf35..8cf00ca6 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
@@ -20,8 +20,6 @@ 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;
@@ -62,15 +60,12 @@ import org.eclipse.ui.PlatformUI;
* Search for GitHub repositories wizard page.
*/
@SuppressWarnings("restriction")
-public class RepositorySearchWizardPage extends WizardPage implements IRepositorySearchResult {
+public class RepositorySearchWizardPage extends WizardPage implements
+ IRepositorySearchResult {
private SearchRepository[] repositories = null;
- private final GitHubClient client = new GitHubClient(
- IGitHubConstants.HOST_API_V2, -1, IGitHubConstants.PROTOCOL_HTTPS);
-
- private final RepositoryService repositoryService = new RepositoryService(
- client);
+ private final RepositoryService repositoryService;
private Text searchText;
@@ -81,11 +76,14 @@ public class RepositorySearchWizardPage extends WizardPage implements IRepositor
super("repoSearchPage", Messages.RepositorySearchWizardPage_Title, null); //$NON-NLS-1$
setDescription(Messages.RepositorySearchWizardPage_Description);
setPageComplete(false);
+
+ repositoryService = new RepositoryService();
+ GitHub.configureClient(repositoryService.getClient());
}
/**
* Get selected repositories
- *
+ *
* @return repositories
*/
protected SearchRepository[] getRepositories() {
@@ -93,7 +91,7 @@ public class RepositorySearchWizardPage extends WizardPage implements IRepositor
}
/**
- *
+ *
*/
public void createControl(Composite parent) {
final Composite root = new Composite(parent, SWT.NONE);
@@ -292,13 +290,12 @@ public class RepositorySearchWizardPage extends WizardPage implements IRepositor
}
}
- public GitRepositoryInfo getGitRepositoryInfo() throws NoRepositoryInfoException {
- GitHubClient client = GitHub
- .configureClient(new GitHubClient());
- RepositoryService service = new RepositoryService(client);
+ public GitRepositoryInfo getGitRepositoryInfo()
+ throws NoRepositoryInfoException {
String cloneUrl = null;
try {
- Repository fullRepo = service.getRepository(repositories[0]);
+ Repository fullRepo = repositoryService
+ .getRepository(repositories[0]);
cloneUrl = fullRepo.getCloneUrl();
} catch (IOException e) {
throw new NoRepositoryInfoException(e.getMessage(), e);
diff --git a/pom.xml b/pom.xml
index d815977d..c5c0180e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -40,12 +40,12 @@
</licenses>
<properties>
- <tycho-version>0.13.0</tycho-version>
- <egit-site>file:/${basedir}/../../egit/org.eclipse.egit-updatesite/target/site</egit-site>
+ <tycho-version>0.15.0</tycho-version>
+ <egit-site>file:/${basedir}/../../egit/org.eclipse.egit.repository/target/repository</egit-site>
<platform-version-name>indigo</platform-version-name>
<mylyn-site>http://download.eclipse.org/mylyn/releases/3.7</mylyn-site>
<eclipse-site>http://download.eclipse.org/releases/${platform-version-name}</eclipse-site>
- <orbit-site>http://download.eclipse.org/tools/orbit/downloads/drops/R20120119162704/repository</orbit-site>
+ <orbit-site>http://download.eclipse.org/tools/orbit/downloads/drops/R20120526062928/repository/</orbit-site>
<download-publish-path>/home/data/httpd/download.eclipse.org/egit/github/updates-nightly</download-publish-path>
</properties>
@@ -131,7 +131,39 @@
<version>${tycho-version}</version>
<configuration>
<resolver>p2</resolver>
- <pomDependencies>consider</pomDependencies>
+ <pomDependencies>consider</pomDependencies>
+ <environments>
+ <environment>
+ <os>linux</os>
+ <ws>gtk</ws>
+ <arch>x86</arch>
+ </environment>
+ <environment>
+ <os>linux</os>
+ <ws>gtk</ws>
+ <arch>x86_64</arch>
+ </environment>
+ <environment>
+ <os>win32</os>
+ <ws>win32</ws>
+ <arch>x86</arch>
+ </environment>
+ <environment>
+ <os>win32</os>
+ <ws>win32</ws>
+ <arch>x86_64</arch>
+ </environment>
+ <environment>
+ <os>macosx</os>
+ <ws>cocoa</ws>
+ <arch>x86</arch>
+ </environment>
+ <environment>
+ <os>macosx</os>
+ <ws>cocoa</ws>
+ <arch>x86_64</arch>
+ </environment>
+ </environments>
</configuration>
</plugin>
<plugin>

Back to the top