Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.eclipse_iplog2
-rw-r--r--org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/AllHeadlessTests.java13
-rw-r--r--org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/RepositoryServiceTest.java325
-rw-r--r--org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/RepositoryTest.java2
-rw-r--r--org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/RequestExceptionTest.java102
-rw-r--r--org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/Language.java232
-rw-r--r--org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/Repository.java20
-rw-r--r--org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/RepositoryId.java10
-rw-r--r--org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/SearchRepository.java10
-rw-r--r--org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/client/AuthInterceptor.java1
-rw-r--r--org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/client/EntityDeleteMethod.java2
-rw-r--r--org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/client/GitHubClient.java2
-rw-r--r--org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/client/GitHubRequest.java6
-rw-r--r--org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/client/GitHubResponse.java3
-rw-r--r--org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/client/IGitHubConstants.java2
-rw-r--r--org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/client/NoSuchPageException.java7
-rw-r--r--org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/client/PageIterator.java11
-rw-r--r--org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/client/PageLinks.java2
-rw-r--r--org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/client/PagedRequest.java4
-rw-r--r--org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/client/RequestException.java24
-rw-r--r--org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/service/CollaboratorService.java2
-rw-r--r--org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/service/CommitService.java3
-rw-r--r--org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/service/DataService.java2
-rw-r--r--org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/service/DownloadService.java4
-rw-r--r--org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/service/GistService.java9
-rw-r--r--org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/service/GitHubService.java3
-rw-r--r--org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/service/IssueService.java5
-rw-r--r--org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/service/PullRequestService.java2
-rw-r--r--org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/service/RepositoryService.java148
-rw-r--r--org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/util/LabelComparator.java1
-rw-r--r--org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/util/UrlUtils.java6
-rw-r--r--org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/internal/github/core/GitHubException.java26
-rw-r--r--org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/internal/github/core/Messages.java3
-rw-r--r--org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/internal/github/core/issue/IssueTaskDataHandler.java15
-rw-r--r--org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/internal/github/core/messages.properties9
-rw-r--r--org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/internal/github/core/pr/PullRequestTaskDataHandler.java25
-rw-r--r--org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/internal/github/ui/pr/CommitAttributePart.java12
-rw-r--r--org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/internal/github/ui/pr/FetchPullRequestHandler.java4
-rw-r--r--org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/internal/github/ui/pr/Messages.java4
-rw-r--r--org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/internal/github/ui/pr/PullRequestConnectorUi.java32
-rw-r--r--org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/internal/github/ui/pr/messages.properties2
-rw-r--r--pom.xml2
42 files changed, 866 insertions, 233 deletions
diff --git a/.eclipse_iplog b/.eclipse_iplog
index 11d0b49e..65457830 100644
--- a/.eclipse_iplog
+++ b/.eclipse_iplog
@@ -7,7 +7,7 @@
[consumes "technology.jgit"]
name = JGit
- version = 1.0.0
+ version = 1.1.0
license = Eclipse Distribution License v1.0
[CQ "5162"]
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 fe9b68f5..e7bc1d74 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
@@ -37,12 +37,13 @@ import org.junit.runners.Suite.SuiteClasses;
OrganizationServiceTest.class, PagedRequestTest.class,
PullRequestMarkerTest.class, PullRequestServiceTest.class,
PullRequestTest.class, ReferenceTest.class, RepositoryCommitTest.class,
- RepositoryIdTest.class, RepositoryTest.class, RequestErrorTest.class,
- SearchRepositoryTest.class, ShaResourceTest.class, TagTest.class,
- TeamServiceTest.class, TeamTest.class, TreeEntryTest.class,
- TreeTest.class, TypedResourceTest.class, UrlUtilsTest.class,
- UserPlanTest.class, UserServiceTest.class, UserTest.class,
- WatcherServiceTest.class })
+ RepositoryIdTest.class, RepositoryServiceTest.class,
+ RepositoryTest.class, RequestErrorTest.class,
+ RequestExceptionTest.class, SearchRepositoryTest.class,
+ ShaResourceTest.class, TagTest.class, TeamServiceTest.class,
+ TeamTest.class, TreeEntryTest.class, TreeTest.class,
+ TypedResourceTest.class, UrlUtilsTest.class, UserPlanTest.class,
+ UserServiceTest.class, UserTest.class, WatcherServiceTest.class })
public class AllHeadlessTests {
}
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
new file mode 100644
index 00000000..41dd9afa
--- /dev/null
+++ b/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/RepositoryServiceTest.java
@@ -0,0 +1,325 @@
+/******************************************************************************
+ * Copyright (c) 2011 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.assertNotNull;
+import static org.mockito.Matchers.any;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.verify;
+
+import java.io.IOException;
+import java.util.Collections;
+
+import org.eclipse.egit.github.core.Repository;
+import org.eclipse.egit.github.core.RepositoryId;
+import org.eclipse.egit.github.core.User;
+import org.eclipse.egit.github.core.client.GitHubClient;
+import org.eclipse.egit.github.core.client.GitHubRequest;
+import org.eclipse.egit.github.core.client.GitHubResponse;
+import org.eclipse.egit.github.core.service.RepositoryService;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.runners.MockitoJUnitRunner;
+
+/**
+ * Unit tests of {@link RepositoryService}
+ */
+@RunWith(MockitoJUnitRunner.class)
+public class RepositoryServiceTest {
+
+ @Mock
+ private GitHubClient client;
+
+ @Mock
+ private GitHubResponse response;
+
+ private RepositoryId repo;
+
+ private RepositoryService service;
+
+ /**
+ * Test case set up
+ *
+ * @throws IOException
+ */
+ @Before
+ public void before() throws IOException {
+ service = new RepositoryService(client);
+ doReturn(response).when(client).get(any(GitHubRequest.class));
+ repo = new RepositoryId("o", "n");
+ }
+
+ /**
+ * Create service using default constructor
+ */
+ @Test
+ public void constructor() {
+ assertNotNull(new RepositoryService().getClient());
+ }
+
+ /**
+ * Create repository with null repository
+ *
+ * @throws IOException
+ */
+ @Test(expected = IllegalArgumentException.class)
+ public void createRepositoryNullRepository() throws IOException {
+ service.createRepository(null);
+ }
+
+ /**
+ * Create repository
+ *
+ * @throws IOException
+ */
+ @Test
+ public void createRepository() throws IOException {
+ Repository repo = new Repository();
+ repo.setName("n");
+ repo.setOwner(new User().setLogin("o"));
+ service.createRepository(repo);
+ verify(client).post("/user/repos", repo, Repository.class);
+ }
+
+ /**
+ * Create repository with null organization name
+ *
+ * @throws IOException
+ */
+ @Test(expected = IllegalArgumentException.class)
+ public void createOrgRepositoryNullOrg() throws IOException {
+ service.createRepository(null, new Repository());
+ }
+
+ /**
+ * Create repository with empty organizaton name
+ *
+ * @throws IOException
+ */
+ @Test(expected = IllegalArgumentException.class)
+ public void createOrgRepositoryEmptyOrg() throws IOException {
+ service.createRepository("", new Repository());
+ }
+
+ /**
+ * Create organization repository with null repository
+ *
+ * @throws IOException
+ */
+ @Test(expected = IllegalArgumentException.class)
+ public void createOrgRepositoryNullRepository() throws IOException {
+ service.createRepository("anorg", null);
+ }
+
+ /**
+ * Create organization repository
+ *
+ * @throws IOException
+ */
+ @Test
+ public void createOrgRepository() throws IOException {
+ Repository repo = new Repository();
+ repo.setName("n");
+ repo.setOwner(new User().setLogin("o"));
+ service.createRepository("abc", repo);
+ verify(client).post("/orgs/abc/repos", repo, Repository.class);
+ }
+
+ /**
+ * Get repository using an repository provider
+ *
+ * @throws IOException
+ */
+ @Test
+ public void getRepositoryProvider() throws IOException {
+ service.getRepository(repo);
+ GitHubRequest request = new GitHubRequest();
+ request.setUri("/repos/o/n");
+ verify(client).get(request);
+ }
+
+ /**
+ * Get repository using owner owner and name
+ *
+ * @throws IOException
+ */
+ @Test
+ public void getRepository() throws IOException {
+ service.getRepository("o", "n");
+ GitHubRequest request = new GitHubRequest();
+ request.setUri("/repos/o/n");
+ verify(client).get(request);
+ }
+
+ /**
+ * Get forks
+ *
+ * @throws IOException
+ */
+ @Test
+ public void getForks() throws IOException {
+ service.getForks(repo);
+ GitHubRequest request = new GitHubRequest();
+ request.setUri(Utils.page("/repos/o/n/forks"));
+ verify(client).get(request);
+ }
+
+ /**
+ * Fork repository
+ *
+ * @throws IOException
+ */
+ @Test
+ public void forkRepository() throws IOException {
+ service.forkRepository(repo);
+ verify(client).post("/repos/o/n/forks", null, Repository.class);
+ }
+
+ /**
+ * Fork repository to organization
+ *
+ * @throws IOException
+ */
+ @Test
+ public void forkRepositoryToOrg() throws IOException {
+ service.forkRepository(repo, "abc");
+ verify(client).post("/repos/o/n/forks",
+ Collections.singletonMap("org", "abc"), Repository.class);
+ }
+
+ /**
+ * Get repositories
+ *
+ * @throws IOException
+ */
+ @Test
+ public void getRepositories() throws IOException {
+ service.getRepositories();
+ GitHubRequest request = new GitHubRequest();
+ request.setUri(Utils.page("/user/repos"));
+ verify(client).get(request);
+ }
+
+ /**
+ * Get repositories with null user
+ *
+ * @throws IOException
+ */
+ @Test(expected = IllegalArgumentException.class)
+ public void getRepositoriesNullUser() throws IOException {
+ service.getRepositories(null);
+ }
+
+ /**
+ * Get repositories with empty user
+ *
+ * @throws IOException
+ */
+ @Test(expected = IllegalArgumentException.class)
+ public void getRepositoriesEmptyUser() throws IOException {
+ service.getRepositories("");
+ }
+
+ /**
+ * Get user repositories
+ *
+ * @throws IOException
+ */
+ @Test
+ public void getUserRepositories() throws IOException {
+ service.getRepositories("u1");
+ GitHubRequest request = new GitHubRequest();
+ request.setUri(Utils.page("/users/u1/repos"));
+ verify(client).get(request);
+ }
+
+ /**
+ * Get repositories with null organization
+ *
+ * @throws IOException
+ */
+ @Test(expected = IllegalArgumentException.class)
+ public void getRepositoriesNullOrg() throws IOException {
+ service.getOrgRepositories(null);
+ }
+
+ /**
+ * Get repositories with empty organization
+ *
+ * @throws IOException
+ */
+ @Test(expected = IllegalArgumentException.class)
+ public void getRepositoriesEmptyOrg() throws IOException {
+ service.getOrgRepositories("");
+ }
+
+ /**
+ * Get organization repositories
+ *
+ * @throws IOException
+ */
+ @Test
+ public void getOrgRepositories() throws IOException {
+ service.getOrgRepositories("o1");
+ GitHubRequest request = new GitHubRequest();
+ request.setUri(Utils.page("/orgs/o1/repos"));
+ verify(client).get(request);
+ }
+
+ /**
+ * Search repositories with null query
+ *
+ * @throws IOException
+ */
+ @Test(expected = IllegalArgumentException.class)
+ public void searchRepositoriesNullQuery() throws IOException {
+ service.searchRepositories(null);
+ }
+
+ /**
+ * Search repository with empty query
+ *
+ * @throws IOException
+ */
+ @Test(expected = IllegalArgumentException.class)
+ public void searchRepositoriesEmptyQuery() throws IOException {
+ service.searchRepositories("");
+ }
+
+ /**
+ * Search repositories
+ *
+ * @throws IOException
+ */
+ @Test
+ public void searchRepositories() throws IOException {
+ service.searchRepositories("test");
+ GitHubRequest request = new GitHubRequest();
+ request.setUri(Utils.page("/api/v2/json/repos/search/test"));
+ verify(client).get(request);
+ }
+
+ /**
+ * Search repositories matching language
+ *
+ * @throws IOException
+ */
+ @Test
+ 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"));
+ verify(client).get(request);
+ }
+}
diff --git a/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/RepositoryTest.java b/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/RepositoryTest.java
index 5f2bc565..5abe1779 100644
--- a/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/RepositoryTest.java
+++ b/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/RepositoryTest.java
@@ -41,6 +41,7 @@ public class RepositoryTest {
assertNull(repo.getHtmlUrl());
assertNull(repo.getLanguage());
assertNull(repo.getMasterBranch());
+ assertNull(repo.getMirrorUrl());
assertNull(repo.getName());
assertEquals(0, repo.getOpenIssues());
assertNull(repo.getOwner());
@@ -95,6 +96,7 @@ public class RepositoryTest {
assertTrue(repo.setHasIssues(true).isHasIssues());
assertTrue(repo.setHasWiki(true).isHasWiki());
assertTrue(repo.setPrivate(true).isPrivate());
+ assertEquals("mirror", repo.setMirrorUrl("mirror").getMirrorUrl());
}
/**
diff --git a/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/RequestExceptionTest.java b/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/RequestExceptionTest.java
new file mode 100644
index 00000000..8aa2c423
--- /dev/null
+++ b/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/RequestExceptionTest.java
@@ -0,0 +1,102 @@
+/******************************************************************************
+ * Copyright (c) 2011 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.assertNotNull;
+
+import org.eclipse.egit.github.core.RequestError;
+import org.eclipse.egit.github.core.client.GsonUtils;
+import org.eclipse.egit.github.core.client.RequestException;
+import org.junit.Test;
+
+/**
+ * Unit tests of {@link RequestException}
+ */
+public class RequestExceptionTest {
+
+ /**
+ * Formatted error message for invalid field
+ */
+ @Test
+ public void invalidField() {
+ RequestError error = GsonUtils.fromJson(
+ "{\"errors\":[{\"code\":\"invalid\", \"field\":\"page\"}]}",
+ RequestError.class);
+ RequestException e = new RequestException(error, 400);
+ String formatted = e.formatErrors();
+ assertNotNull(formatted);
+ assertEquals("400: Invalid value for 'page' field", formatted);
+ }
+
+ /**
+ * Formatted error message with invalid field value
+ */
+ @Test
+ public void invalidFieldValue() {
+ RequestError error = GsonUtils
+ .fromJson(
+ "{\"errors\":[{\"code\":\"invalid\", \"field\":\"name\", \"value\":\"100\"}]}",
+ RequestError.class);
+ RequestException e = new RequestException(error, 401);
+ String formatted = e.formatErrors();
+ assertNotNull(formatted);
+ assertEquals("401: Invalid value of '100' for 'name' field", formatted);
+ }
+
+ /**
+ * Formatted error message for missing field
+ */
+ @Test
+ public void missingField() {
+ RequestError error = GsonUtils
+ .fromJson(
+ "{\"errors\":[{\"code\":\"missing_field\", \"field\":\"due\"}]}",
+ RequestError.class);
+ RequestException e = new RequestException(error, 422);
+ String formatted = e.formatErrors();
+ assertNotNull(formatted);
+ assertEquals("422: Missing required 'due' field", formatted);
+ }
+
+ /**
+ * Formatted error message for existing resource with field
+ */
+ @Test
+ public void existentField() {
+ RequestError error = GsonUtils
+ .fromJson(
+ "{\"errors\":[{\"code\":\"already_exists\", \"field\":\"severity\", \"resource\":\"Issue\"}]}",
+ RequestError.class);
+ RequestException e = new RequestException(error, 500);
+ String formatted = e.formatErrors();
+ assertNotNull(formatted);
+ assertEquals(
+ "500: Issue resource with 'severity' field already exists",
+ formatted);
+ }
+
+ /**
+ * Formatted error message for error in field
+ */
+ @Test
+ public void errorField() {
+ RequestError error = GsonUtils
+ .fromJson(
+ "{\"errors\":[{\"field\":\"priority\", \"resource\":\"Gist\"}]}",
+ RequestError.class);
+ RequestException e = new RequestException(error, 400);
+ String formatted = e.formatErrors();
+ assertNotNull(formatted);
+ assertEquals("400: Error with 'priority' field in Gist resource",
+ formatted);
+ }
+}
diff --git a/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/Language.java b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/Language.java
index 8151c1b7..e220e230 100644
--- a/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/Language.java
+++ b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/Language.java
@@ -16,237 +16,237 @@ package org.eclipse.egit.github.core;
public enum Language {
/** ACTIONSCRIPT */
- ACTIONSCRIPT("ActionScript"),
+ ACTIONSCRIPT("ActionScript"), //$NON-NLS-1$
/** ADA */
- ADA("Ada"),
+ ADA("Ada"), //$NON-NLS-1$
/** APPLESCRIPT */
- APPLESCRIPT("AppleScript"),
+ APPLESCRIPT("AppleScript"), //$NON-NLS-1$
/** ARC */
- ARC("Arc"),
+ ARC("Arc"), //$NON-NLS-1$
/** ASP */
- ASP("ASP"),
+ ASP("ASP"), //$NON-NLS-1$
/** ASSEMBLY */
- ASSEMBLY("Assembly"),
+ ASSEMBLY("Assembly"), //$NON-NLS-1$
/** BATCHFILE */
- BATCHFILE("Batchfile"),
+ BATCHFILE("Batchfile"), //$NON-NLS-1$
/** BEFUNGE */
- BEFUNGE("Befunge"),
+ BEFUNGE("Befunge"), //$NON-NLS-1$
/** BLITZMAX */
- BLITZMAX("BlitzMax"),
+ BLITZMAX("BlitzMax"), //$NON-NLS-1$
/** BOO */
- BOO("Boo"),
+ BOO("Boo"), //$NON-NLS-1$
/** BRAINFUCK */
- BRAINFUCK("Brainfuck"),
+ BRAINFUCK("Brainfuck"), //$NON-NLS-1$
/** C */
- C("C"),
+ C("C"), //$NON-NLS-1$
/** CSHARP */
- CSHARP("C#"),
+ CSHARP("C#"), //$NON-NLS-1$
/** CPLUSPLUS */
- CPLUSPLUS("C++"),
+ CPLUSPLUS("C++"), //$NON-NLS-1$
/** C_OBJDUMP */
- C_OBJDUMP("C-ObjDump"),
+ C_OBJDUMP("C-ObjDump"), //$NON-NLS-1$
/** CHUCK */
- CHUCK("Chuck"),
+ CHUCK("Chuck"), //$NON-NLS-1$
/** CLOJURE */
- CLOJURE("Clojure"),
+ CLOJURE("Clojure"), //$NON-NLS-1$
/** COFFEESCRIPT */
- COFFEESCRIPT("CoffeeScript"),
+ COFFEESCRIPT("CoffeeScript"), //$NON-NLS-1$
/** COLDFUSION */
- COLDFUSION("ColdFusion"),
+ COLDFUSION("ColdFusion"), //$NON-NLS-1$
/** COMMON_LISP */
- COMMON_LISP("Common Lisp"),
+ COMMON_LISP("Common Lisp"), //$NON-NLS-1$
/** CPP_OBJDUMP */
- CPP_OBJDUMP("Cpp-ObjDump"),
+ CPP_OBJDUMP("Cpp-ObjDump"), //$NON-NLS-1$
/** CSS */
- CSS("CSS"),
+ CSS("CSS"), //$NON-NLS-1$
/** CUCUMBER */
- CUCUMBER("Cucumber"),
+ CUCUMBER("Cucumber"), //$NON-NLS-1$
/** CYTHON */
- CYTHON("Cython"),
+ CYTHON("Cython"), //$NON-NLS-1$
/** D */
- D("D"),
+ D("D"), //$NON-NLS-1$
/** D_OBJDUMP */
- D_OBJDUMP("D-ObjDump"),
+ D_OBJDUMP("D-ObjDump"), //$NON-NLS-1$
/** DARCS_PATCH */
- DARCS_PATCH("Darcs Patch"),
+ DARCS_PATCH("Darcs Patch"), //$NON-NLS-1$
/** DELPHI */
- DELPHI("Delphi"),
+ DELPHI("Delphi"), //$NON-NLS-1$
/** DIFF */
- DIFF("Diff"),
+ DIFF("Diff"), //$NON-NLS-1$
/** DYLAN */
- DYLAN("Dylan"),
+ DYLAN("Dylan"), //$NON-NLS-1$
/** EIFFEL */
- EIFFEL("Eiffel"),
+ EIFFEL("Eiffel"), //$NON-NLS-1$
/** EMACS_LISP */
- EMACS_LISP("Emacs Lisp"),
+ EMACS_LISP("Emacs Lisp"), //$NON-NLS-1$
/** ERLANG */
- ERLANG("Erlang"),
+ ERLANG("Erlang"), //$NON-NLS-1$
/** FSHARP */
- FSHARP("F#"),
+ FSHARP("F#"), //$NON-NLS-1$
/** FACTOR */
- FACTOR("Factor"),
+ FACTOR("Factor"), //$NON-NLS-1$
/** FANCY */
- FANCY("Fancy"),
+ FANCY("Fancy"), //$NON-NLS-1$
/** FORTRAN */
- FORTRAN("FORTRAN"),
+ FORTRAN("FORTRAN"), //$NON-NLS-1$
/** GAS */
- GAS("GAS"),
+ GAS("GAS"), //$NON-NLS-1$
/** GENSHI */
- GENSHI("Genshi"),
+ GENSHI("Genshi"), //$NON-NLS-1$
/** GENTOO_EBUILD */
- GENTOO_EBUILD("Gentoo Ebuild"),
+ GENTOO_EBUILD("Gentoo Ebuild"), //$NON-NLS-1$
/** GENTOO_ECLASS */
- GENTOO_ECLASS("Gentoo Eclass"),
+ GENTOO_ECLASS("Gentoo Eclass"), //$NON-NLS-1$
/** GO */
- GO("Go"),
+ GO("Go"), //$NON-NLS-1$
/** GROFF */
- GROFF("Groff"),
+ GROFF("Groff"), //$NON-NLS-1$
/** GROOVY */
- GROOVY("Groovy"),
+ GROOVY("Groovy"), //$NON-NLS-1$
/** HAML */
- HAML("Haml"),
+ HAML("Haml"), //$NON-NLS-1$
/** HASKELL */
- HASKELL("Haskell"),
+ HASKELL("Haskell"), //$NON-NLS-1$
/** HAXE */
- HAXE("HaXe"),
+ HAXE("HaXe"), //$NON-NLS-1$
/** HTML */
- HTML("HTML"),
+ HTML("HTML"), //$NON-NLS-1$
/** HTML_DJANGO */
- HTML_DJANGO("HTML+Django"),
+ HTML_DJANGO("HTML+Django"), //$NON-NLS-1$
/** HTML_ERB */
- HTML_ERB("HTML+ERB"),
+ HTML_ERB("HTML+ERB"), //$NON-NLS-1$
/** HTML_PHP */
- HTML_PHP("HTML+PHP"),
+ HTML_PHP("HTML+PHP"), //$NON-NLS-1$
/** INI */
- INI("INI"),
+ INI("INI"), //$NON-NLS-1$
/** IO */
- IO("Io"),
+ IO("Io"), //$NON-NLS-1$
/** IRC_LOG */
- IRC_LOG("IRC log"),
+ IRC_LOG("IRC log"), //$NON-NLS-1$
/** JAVA */
- JAVA("Java"),
+ JAVA("Java"), //$NON-NLS-1$
/** JAVA_SERVER_PAGE */
- JAVA_SERVER_PAGE("Java Server Pages"),
+ JAVA_SERVER_PAGE("Java Server Pages"), //$NON-NLS-1$
/** JAVASCRIPT */
- JAVASCRIPT("JavaScript"),
+ JAVASCRIPT("JavaScript"), //$NON-NLS-1$
/** LILYPOND */
- LILYPOND("LilyPond"),
+ LILYPOND("LilyPond"), //$NON-NLS-1$
/** LITERATE_HASKELL */
- LITERATE_HASKELL("Literate Haskell"),
+ LITERATE_HASKELL("Literate Haskell"), //$NON-NLS-1$
/** LLVM */
- LLVM("LLVM"),
+ LLVM("LLVM"), //$NON-NLS-1$
/** LUA */
- LUA("Lua"),
+ LUA("Lua"), //$NON-NLS-1$
/** MAKEFILE */
- MAKEFILE("Makefile"),
+ MAKEFILE("Makefile"), //$NON-NLS-1$
/** MAKO */
- MAKO("Mako"),
+ MAKO("Mako"), //$NON-NLS-1$
/** MARKDOWN */
- MARKDOWN("Markdown"),
+ MARKDOWN("Markdown"), //$NON-NLS-1$
/** MATLAB */
- MATLAB("Matlab"),
+ MATLAB("Matlab"), //$NON-NLS-1$
/** MAX_MSP */
- MAX_MSP("Max/MSP"),
+ MAX_MSP("Max/MSP"), //$NON-NLS-1$
/** MIRAH */
- MIRAH("Mirah"),
+ MIRAH("Mirah"), //$NON-NLS-1$
/** MOOCODE */
- MOOCODE("Moocode"),
+ MOOCODE("Moocode"), //$NON-NLS-1$
/** MUPAD */
- MUPAD("mupad"),
+ MUPAD("mupad"), //$NON-NLS-1$
/** MYGHTY */
- MYGHTY("Myghty"),
+ MYGHTY("Myghty"), //$NON-NLS-1$
/** NIMROD */
- NIMROD("Nimrod"),
+ NIMROD("Nimrod"), //$NON-NLS-1$
/** NU */
- NU("Nu"),
+ NU("Nu"), //$NON-NLS-1$
/** NUMPY */
- NUMPY("NumPy"),
+ NUMPY("NumPy"), //$NON-NLS-1$
/** OBJDUMP */
- OBJDUMP("ObjDump"),
+ OBJDUMP("ObjDump"), //$NON-NLS-1$
/** OBJECTIVE_C */
- OBJECTIVE_C("Objective-C"),
+ OBJECTIVE_C("Objective-C"), //$NON-NLS-1$
/** OBJECTIVE_J */
- OBJECTIVE_J("Objective-J"),
+ OBJECTIVE_J("Objective-J"), //$NON-NLS-1$
/** OCAML */
- OCAML("OCaml"),
+ OCAML("OCaml"), //$NON-NLS-1$
/** OOC */
- OOC("ooc"),
+ OOC("ooc"), //$NON-NLS-1$
/** OPENCL */
- OPENCL("OpenCL"),
+ OPENCL("OpenCL"), //$NON-NLS-1$
/** PARROT_INTERNAL_REPRESENTATION */
- PARROT_INTERNAL_REPRESENTATION("Parrot Internal Representation"),
+ PARROT_INTERNAL_REPRESENTATION("Parrot Internal Representation"), //$NON-NLS-1$
/** PERL */
- PERL("Perl"),
+ PERL("Perl"), //$NON-NLS-1$
/** PROLOG */
- PROLOG("Prolog"),
+ PROLOG("Prolog"), //$NON-NLS-1$
/** PHP */
- PHP("PHP"),
+ PHP("PHP"), //$NON-NLS-1$
/** PURE_DATA */
- PURE_DATA("Pure Data"),
+ PURE_DATA("Pure Data"), //$NON-NLS-1$
/** PYTHON */
- PYTHON("Python"),
+ PYTHON("Python"), //$NON-NLS-1$
/** R */
- R("R"),
+ R("R"), //$NON-NLS-1$
/** RACKET */
- RACKET("Racket"),
+ RACKET("Racket"), //$NON-NLS-1$
/** RAW_TOKEN_DATA */
- RAW_TOKEN_DATA("Raw token data"),
+ RAW_TOKEN_DATA("Raw token data"), //$NON-NLS-1$
/** REBOL */
- REBOL("Rebol"),
+ REBOL("Rebol"), //$NON-NLS-1$
/** REDCODE */
- REDCODE("Redcode"),
+ REDCODE("Redcode"), //$NON-NLS-1$
/** RESTRUCTUREDTEXT */
- RESTRUCTUREDTEXT("reStructuredText"),
+ RESTRUCTUREDTEXT("reStructuredText"), //$NON-NLS-1$
/** RHTML */
- RHTML("RHTML"),
+ RHTML("RHTML"), //$NON-NLS-1$
/** RUBY */
- RUBY("Ruby"),
+ RUBY("Ruby"), //$NON-NLS-1$
/** SASS */
- SASS("Sass"),
+ SASS("Sass"), //$NON-NLS-1$
/** SCALA */
- SCALA("Scala"),
+ SCALA("Scala"), //$NON-NLS-1$
/** SCHEME */
- SCHEME("Scheme"),
+ SCHEME("Scheme"), //$NON-NLS-1$
/** SELF */
- SELF("Self"),
+ SELF("Self"), //$NON-NLS-1$
/** SHELL */
- SHELL("Shell"),
+ SHELL("Shell"), //$NON-NLS-1$
/** SMALLTALK */
- SMALLTALK("Smalltalk"),
+ SMALLTALK("Smalltalk"), //$NON-NLS-1$
/** SMARTY */
- SMARTY("Smarty"),
+ SMARTY("Smarty"), //$NON-NLS-1$
/** STANDARD_ML */
- STANDARD_ML("Standard ML"),
+ STANDARD_ML("Standard ML"), //$NON-NLS-1$
/** SUPERCOLLIDER */
- SUPERCOLLIDER("SuperCollider"),
+ SUPERCOLLIDER("SuperCollider"), //$NON-NLS-1$
/** TCL */
- TCL("Tcl"),
+ TCL("Tcl"), //$NON-NLS-1$
/** TCSH */
- TCSH("Tcsh"),
+ TCSH("Tcsh"), //$NON-NLS-1$
/** TEX */
- TEX("TeX"),
+ TEX("TeX"), //$NON-NLS-1$
/** TEXT */
- TEXT("Text"),
+ TEXT("Text"), //$NON-NLS-1$
/** TEXTILE */
- TEXTILE("Textile"),
+ TEXTILE("Textile"), //$NON-NLS-1$
/** VALA */
- VALA("Vala"),
+ VALA("Vala"), //$NON-NLS-1$
/** VERILOG */
- VERILOG("Verilog"),
+ VERILOG("Verilog"), //$NON-NLS-1$
/** VHDL */
- VHDL("VHDL"),
+ VHDL("VHDL"), //$NON-NLS-1$
/** VIML */
- VIML("VimL"),
+ VIML("VimL"), //$NON-NLS-1$
/** VISUAL_BASIC */
- VISUAL_BASIC("Visual Basic"),
+ VISUAL_BASIC("Visual Basic"), //$NON-NLS-1$
/** XML */
- XML("XML"),
+ XML("XML"), //$NON-NLS-1$
/** XQUERY */
- XQUERY("XQuery"),
+ XQUERY("XQuery"), //$NON-NLS-1$
/** XS */
- XS("XS"),
+ XS("XS"), //$NON-NLS-1$
/** YAML */
- YAML("YAML");
+ YAML("YAML"); //$NON-NLS-1$
private final String value;
diff --git a/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/Repository.java b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/Repository.java
index 8ab2e3a2..b0c53f96 100644
--- a/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/Repository.java
+++ b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/Repository.java
@@ -66,6 +66,8 @@ public class Repository implements IRepositoryIdProvider, Serializable {
private String masterBranch;
+ private String mirrorUrl;
+
private String name;
private String sshUrl;
@@ -397,6 +399,22 @@ public class Repository implements IRepositoryIdProvider, Serializable {
}
/**
+ * @return mirrorUrl
+ */
+ public String getMirrorUrl() {
+ return mirrorUrl;
+ }
+
+ /**
+ * @param mirrorUrl
+ * @return this repository
+ */
+ public Repository setMirrorUrl(String mirrorUrl) {
+ this.mirrorUrl = mirrorUrl;
+ return this;
+ }
+
+ /**
* @return name
*/
public String getName() {
@@ -489,6 +507,6 @@ public class Repository implements IRepositoryIdProvider, Serializable {
final String login = owner.getLogin();
if (login == null || login.length() == 0)
return null;
- return login + "/" + name;
+ return login + "/" + name; //$NON-NLS-1$
}
}
diff --git a/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/RepositoryId.java b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/RepositoryId.java
index 0f482c49..29c2d93c 100644
--- a/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/RepositoryId.java
+++ b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/RepositoryId.java
@@ -103,13 +103,13 @@ public class RepositoryId implements IRepositoryIdProvider, Serializable {
*/
public RepositoryId(final String owner, final String name) {
if (owner == null)
- throw new IllegalArgumentException("Owner cannot be null");
+ throw new IllegalArgumentException("Owner cannot be null"); //$NON-NLS-1$
if (owner.length() == 0)
- throw new IllegalArgumentException("Owner cannot be empty");
+ throw new IllegalArgumentException("Owner cannot be empty"); //$NON-NLS-1$
if (name == null)
- throw new IllegalArgumentException("Name cannot be null");
+ throw new IllegalArgumentException("Name cannot be null"); //$NON-NLS-1$
if (name.length() == 0)
- throw new IllegalArgumentException("Name cannot be empty");
+ throw new IllegalArgumentException("Name cannot be empty"); //$NON-NLS-1$
this.owner = owner;
this.name = name;
@@ -130,7 +130,7 @@ public class RepositoryId implements IRepositoryIdProvider, Serializable {
}
public String generateId() {
- return owner + "/" + name;
+ return owner + "/" + name; //$NON-NLS-1$
}
@Override
diff --git a/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/SearchRepository.java b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/SearchRepository.java
index 4be1557d..68e10434 100644
--- a/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/SearchRepository.java
+++ b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/SearchRepository.java
@@ -55,13 +55,13 @@ public class SearchRepository implements IRepositoryIdProvider, Serializable {
*/
public SearchRepository(String owner, String name) {
if (owner == null)
- throw new IllegalArgumentException("Owner cannot be null");
+ throw new IllegalArgumentException("Owner cannot be null"); //$NON-NLS-1$
if (owner.length() == 0)
- throw new IllegalArgumentException("Owner cannot be empty");
+ throw new IllegalArgumentException("Owner cannot be empty"); //$NON-NLS-1$
if (name == null)
- throw new IllegalArgumentException("Name cannot be null");
+ throw new IllegalArgumentException("Name cannot be null"); //$NON-NLS-1$
if (name.length() == 0)
- throw new IllegalArgumentException("Name cannot be empty");
+ throw new IllegalArgumentException("Name cannot be empty"); //$NON-NLS-1$
this.owner = owner;
this.name = name;
@@ -235,6 +235,6 @@ public class SearchRepository implements IRepositoryIdProvider, Serializable {
final String name = this.name;
if (name == null || name.length() == 0)
return null;
- return owner + "/" + name;
+ return owner + "/" + name; //$NON-NLS-1$
}
}
diff --git a/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/client/AuthInterceptor.java b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/client/AuthInterceptor.java
index 13e6392a..daf5cb70 100644
--- a/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/client/AuthInterceptor.java
+++ b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/client/AuthInterceptor.java
@@ -58,5 +58,4 @@ public class AuthInterceptor implements HttpRequestInterceptor {
authState.setAuthScheme(authScheme);
authState.setCredentials(creds);
}
-
}
diff --git a/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/client/EntityDeleteMethod.java b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/client/EntityDeleteMethod.java
index c64b82a5..f663602a 100644
--- a/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/client/EntityDeleteMethod.java
+++ b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/client/EntityDeleteMethod.java
@@ -16,7 +16,7 @@ import org.apache.http.client.methods.HttpDelete;
import org.apache.http.client.methods.HttpEntityEnclosingRequestBase;
/**
- * DELETE request that supports an entity
+ * DELETE request that supports an enclosed entity
*/
public class EntityDeleteMethod extends HttpEntityEnclosingRequestBase {
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 ebb85d38..a2a6483a 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
@@ -83,7 +83,7 @@ public class GitHubClient {
public static GitHubClient createClient(String url) {
try {
String host = new URL(url).getHost();
- host = SUBDOMAIN_API + "." + host;
+ host = SUBDOMAIN_API + "." + host; //$NON-NLS-1$
return new GitHubClient(host);
} catch (IOException e) {
throw new IllegalArgumentException(e);
diff --git a/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/client/GitHubRequest.java b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/client/GitHubRequest.java
index 41dec1c9..c558c557 100644
--- a/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/client/GitHubRequest.java
+++ b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/client/GitHubRequest.java
@@ -21,7 +21,11 @@ import org.apache.http.client.utils.URLEncodedUtils;
import org.apache.http.message.BasicNameValuePair;
/**
- * GitHub API request class.
+ * GitHub API request class that contains the URI and parameters of the request
+ * as well as the expected {@link Type} of the response.
+ *
+ * The {@link #generateUri()} method should be used to build a full URI that
+ * contains both the base uri and the parameters set.
*/
public class GitHubRequest {
diff --git a/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/client/GitHubResponse.java b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/client/GitHubResponse.java
index 8c4069ab..8b713feb 100644
--- a/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/client/GitHubResponse.java
+++ b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/client/GitHubResponse.java
@@ -13,7 +13,8 @@ package org.eclipse.egit.github.core.client;
import org.apache.http.HttpResponse;
/**
- * GitHub API response class.
+ * GitHub API response class that provides the parsed response body as well as
+ * any links to the first, previous, next, and last responses.
*/
public class GitHubResponse {
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 10d86061..39f49fac 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
@@ -26,7 +26,7 @@ public interface IGitHubConstants {
/** */
String DATE_FORMAT = "yyyy-MM-dd'T'HH:mm:ss'Z'"; //$NON-NLS-1$
/** */
- String DATE_FORMAT_V2_1 = "yyyy/MM/dd HH:mm:ss Z"; //$NON-NLS-N$
+ String DATE_FORMAT_V2_1 = "yyyy/MM/dd HH:mm:ss Z"; //$NON-NLS-1$
/** */
String DATE_FORMAT_V2_2 = "yyyy-MM-dd'T'HH:mm:ss"; //$NON-NLS-1$
diff --git a/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/client/NoSuchPageException.java b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/client/NoSuchPageException.java
index febd775b..83846ab8 100644
--- a/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/client/NoSuchPageException.java
+++ b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/client/NoSuchPageException.java
@@ -14,7 +14,9 @@ import java.io.IOException;
import java.util.NoSuchElementException;
/**
- * Exception class to be thrown when iterating over pages fails
+ * Exception class to be thrown when iterating over pages fails. This exception
+ * wraps an {@link IOException} that is the actual exception that occurred when
+ * the page request was made.
*/
public class NoSuchPageException extends NoSuchElementException {
@@ -30,7 +32,7 @@ public class NoSuchPageException extends NoSuchElementException {
/**
* Create no such page exception
- *
+ *
* @param cause
*/
public NoSuchPageException(IOException cause) {
@@ -46,5 +48,4 @@ public class NoSuchPageException extends NoSuchElementException {
public IOException getCause() {
return cause;
}
-
}
diff --git a/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/client/PageIterator.java b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/client/PageIterator.java
index b12a4bc4..d74f18ea 100644
--- a/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/client/PageIterator.java
+++ b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/client/PageIterator.java
@@ -25,9 +25,18 @@ import org.apache.http.client.utils.URLEncodedUtils;
import org.eclipse.egit.github.core.IResourceProvider;
/**
- * Iterator for getting paged responses
+ * Iterator for getting paged responses. Each call to {@link #next()} will make
+ * a client request for the next page of resources using the URI returned from
+ * the previous request.
+ *
+ * The {@link #hasNext()} method can be used to determine if the last executed
+ * request contained the location of the next page of results.
+ *
+ * This iterator also provides the next and last page numbers as well as the
+ * next and last URIs.
*
* @param <V>
+ * type of resource being iterated over
*/
public class PageIterator<V> implements Iterator<Collection<V>>,
Iterable<Collection<V>> {
diff --git a/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/client/PageLinks.java b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/client/PageLinks.java
index e6c66ab5..6d9bbabd 100644
--- a/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/client/PageLinks.java
+++ b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/client/PageLinks.java
@@ -31,7 +31,7 @@ public class PageLinks {
private static final String DELIM_LINKS = ","; //$NON-NLS-1$
- private static final String DELIM_LINK_PARAM = ";"; //$NON-NLS-1;$
+ private static final String DELIM_LINK_PARAM = ";"; //$NON-NLS-1$
private String first;
private String last;
diff --git a/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/client/PagedRequest.java b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/client/PagedRequest.java
index bb94760a..15238b1b 100644
--- a/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/client/PagedRequest.java
+++ b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/client/PagedRequest.java
@@ -60,6 +60,8 @@ public class PagedRequest<V> extends GitHubRequest {
}
/**
+ * Get initial page size
+ *
* @return pageSize
*/
public int getPageSize() {
@@ -81,6 +83,8 @@ public class PagedRequest<V> extends GitHubRequest {
}
/**
+ * Get initial page number
+ *
* @return page
*/
public int getPage() {
diff --git a/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/client/RequestException.java b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/client/RequestException.java
index 2183f8f7..21ede0f0 100644
--- a/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/client/RequestException.java
+++ b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/client/RequestException.java
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.egit.github.core.client;
+import static org.eclipse.egit.github.core.FieldError.CODE_ALREADY_EXISTS;
import static org.eclipse.egit.github.core.FieldError.CODE_INVALID;
import static org.eclipse.egit.github.core.FieldError.CODE_MISSING_FIELD;
@@ -25,13 +26,15 @@ import org.eclipse.egit.github.core.RequestError;
*/
public class RequestException extends IOException {
- private static final String FIELD_INVALID_WITH_VALUE = "Invalid value of ''{0}'' for field ''{1}''"; //$NON-NLS-1$
+ private static final String FIELD_INVALID_WITH_VALUE = "Invalid value of ''{0}'' for ''{1}'' field"; //$NON-NLS-1$
- private static final String FIELD_INVALID = "Invalid value for field ''{1}''"; //$NON-NLS-1$
+ private static final String FIELD_INVALID = "Invalid value for ''{0}'' field"; //$NON-NLS-1$
- private static final String FIELD_MISSING = "Missing required field ''{0}''"; //$NON-NLS-1$
+ private static final String FIELD_MISSING = "Missing required ''{0}'' field"; //$NON-NLS-1$
- private static final String FIELD_ERROR = "Error with field ''{0}'' in {1} resource"; //$NON-NLS-1$
+ private static final String FIELD_ERROR = "Error with ''{0}'' field in {1} resource"; //$NON-NLS-1$
+
+ private static final String FIELD_EXISTS = "{0} resource with ''{1}'' field already exists"; //$NON-NLS-1$
/**
* serialVersionUID
@@ -85,17 +88,22 @@ public class RequestException extends IOException {
String code = error.getCode();
String value = error.getValue();
String field = error.getField();
+
if (CODE_INVALID.equals(code))
if (value != null)
return MessageFormat.format(FIELD_INVALID_WITH_VALUE, value,
field);
else
return MessageFormat.format(FIELD_INVALID, field);
+
if (CODE_MISSING_FIELD.equals(code))
return MessageFormat.format(FIELD_MISSING, field);
- else
- return MessageFormat
- .format(FIELD_ERROR, field, error.getResource());
+
+ if (CODE_ALREADY_EXISTS.equals(code))
+ return MessageFormat.format(FIELD_EXISTS, error.getResource(),
+ field);
+
+ return MessageFormat.format(FIELD_ERROR, field, error.getResource());
}
/**
@@ -106,7 +114,7 @@ public class RequestException extends IOException {
public String formatErrors() {
String errorMessage = error.getMessage();
if (errorMessage == null)
- errorMessage = "";
+ errorMessage = ""; //$NON-NLS-1$
StringBuilder message = new StringBuilder(errorMessage);
if (message.length() > 0)
message.append(' ').append('(').append(status).append(')');
diff --git a/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/service/CollaboratorService.java b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/service/CollaboratorService.java
index 442ba79b..1e3f1288 100644
--- a/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/service/CollaboratorService.java
+++ b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/service/CollaboratorService.java
@@ -90,7 +90,7 @@ public class CollaboratorService extends GitHubService {
}
/**
- * Is given user a collaborator on the given repository
+ * Is given user a collaborator on the given repository?
*
* @param repository
* @param user
diff --git a/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/service/CommitService.java b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/service/CommitService.java
index e3f80201..19c347eb 100644
--- a/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/service/CommitService.java
+++ b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/service/CommitService.java
@@ -68,7 +68,8 @@ public class CommitService extends GitHubService {
}
/**
- * Get all commits in given repository
+ * Get all commits in given repository beginning at an optional commit SHA-1
+ * and affecting an optional path.
*
* @param repository
* @param sha
diff --git a/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/service/DataService.java b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/service/DataService.java
index ab15f922..2a421178 100644
--- a/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/service/DataService.java
+++ b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/service/DataService.java
@@ -42,7 +42,7 @@ import org.eclipse.egit.github.core.client.GitHubRequest;
import org.eclipse.egit.github.core.client.PagedRequest;
/**
- * Date service class for low-level access to Git repository data.
+ * Data service class for low-level access to Git repository data.
*
* @see <a href="http://developer.github.com/v3/repos/git">GitHub data API
* documentation</a>
diff --git a/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/service/DownloadService.java b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/service/DownloadService.java
index d76289dd..1a4caa0a 100644
--- a/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/service/DownloadService.java
+++ b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/service/DownloadService.java
@@ -277,9 +277,9 @@ public class DownloadService extends GitHubService {
if (resource == null)
throw new IllegalArgumentException(
"Download resource cannot be null"); //$NON-NLS-1$
- if( content == null)
+ if (content == null)
throw new IllegalArgumentException(
- "Content input stream cannot be null"); //$NON-NLS-N$
+ "Content input stream cannot be null"); //$NON-NLS-1$
HttpClient client = createDownloadClient();
diff --git a/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/service/GistService.java b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/service/GistService.java
index a8c24a48..0785dc34 100644
--- a/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/service/GistService.java
+++ b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/service/GistService.java
@@ -240,8 +240,7 @@ public class GistService extends GitHubService {
if (gist == null)
throw new IllegalArgumentException("Gist cannot be null"); //$NON-NLS-1$
String id = gist.getId();
- if (id == null)
- throw new IllegalArgumentException("Gist id cannot be null"); //$NON-NLS-1$
+ checkGistId(id);
StringBuilder uri = new StringBuilder(SEGMENT_GISTS);
uri.append('/').append(id);
@@ -258,8 +257,7 @@ public class GistService extends GitHubService {
*/
public Comment createComment(String gistId, String comment)
throws IOException {
- if (gistId == null)
- throw new IllegalArgumentException("Gist id cannot be null"); //$NON-NLS-1$
+ checkGistId(gistId);
if (comment == null)
throw new IllegalArgumentException("Gist comment cannot be null"); //$NON-NLS-1$
@@ -280,8 +278,7 @@ public class GistService extends GitHubService {
* @throws IOException
*/
public List<Comment> getComments(String gistId) throws IOException {
- if (gistId == null)
- throw new IllegalArgumentException("Gist id cannot be null"); //$NON-NLS-1$
+ checkGistId(gistId);
StringBuilder uri = new StringBuilder(SEGMENT_GISTS);
uri.append('/').append(gistId);
diff --git a/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/service/GitHubService.java b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/service/GitHubService.java
index b1743b75..fd53c2be 100644
--- a/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/service/GitHubService.java
+++ b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/service/GitHubService.java
@@ -37,7 +37,7 @@ public abstract class GitHubService {
protected final GitHubClient client;
/**
- * Create service using default {@link GitHubClient}
+ * Create service using a default {@link GitHubClient}
*/
public GitHubService() {
this(new GitHubClient());
@@ -47,6 +47,7 @@ public abstract class GitHubService {
* Create service for client
*
* @param client
+ * must be non-null
*/
public GitHubService(GitHubClient client) {
if (client == null)
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 a5585314..9b27b6da 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
@@ -33,7 +33,6 @@ import org.eclipse.egit.github.core.Milestone;
import org.eclipse.egit.github.core.User;
import org.eclipse.egit.github.core.client.GitHubClient;
import org.eclipse.egit.github.core.client.GitHubRequest;
-import org.eclipse.egit.github.core.client.IGitHubConstants;
import org.eclipse.egit.github.core.client.PageIterator;
import org.eclipse.egit.github.core.client.PagedRequest;
@@ -198,7 +197,7 @@ public class IssueService extends GitHubService {
int start, int size) {
PagedRequest<Issue> request = createPagedRequest(start, size);
request.setParams(filterData);
- request.setUri(IGitHubConstants.SEGMENT_ISSUES);
+ request.setUri(SEGMENT_ISSUES);
request.setType(new TypeToken<List<Issue>>() {
}.getType());
return createPageIterator(request);
@@ -553,7 +552,7 @@ public class IssueService extends GitHubService {
throws IOException {
verifyRepository(user, repository);
if (comment == null)
- throw new IllegalArgumentException("Comment cannot be null");
+ throw new IllegalArgumentException("Comment cannot be null"); //$NON-NLS-1$
StringBuilder uri = new StringBuilder(SEGMENT_REPOS);
uri.append('/').append(user).append('/').append(repository);
diff --git a/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/service/PullRequestService.java b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/service/PullRequestService.java
index 9602653b..1e044162 100644
--- a/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/service/PullRequestService.java
+++ b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/service/PullRequestService.java
@@ -129,7 +129,7 @@ public class PullRequestService extends GitHubService {
StringBuilder uri = new StringBuilder(SEGMENT_REPOS);
uri.append('/').append(id);
uri.append(SEGMENT_PULLS);
- PagedRequest<PullRequest> request = createPagedRequest();
+ PagedRequest<PullRequest> request = createPagedRequest(start, size);
request.setUri(uri);
if (state != null)
request.setParams(Collections.singletonMap(
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 9e823db5..ca3dff80 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
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.egit.github.core.service;
+import static org.eclipse.egit.github.core.client.IGitHubConstants.PARAM_LANGUAGE;
import static org.eclipse.egit.github.core.client.IGitHubConstants.SEGMENT_FORKS;
import static org.eclipse.egit.github.core.client.IGitHubConstants.SEGMENT_ORGS;
import static org.eclipse.egit.github.core.client.IGitHubConstants.SEGMENT_REPOS;
@@ -34,7 +35,6 @@ import org.eclipse.egit.github.core.RepositoryId;
import org.eclipse.egit.github.core.SearchRepository;
import org.eclipse.egit.github.core.client.GitHubClient;
import org.eclipse.egit.github.core.client.GitHubRequest;
-import org.eclipse.egit.github.core.client.IGitHubConstants;
import org.eclipse.egit.github.core.client.PageIterator;
import org.eclipse.egit.github.core.client.PagedRequest;
@@ -105,11 +105,46 @@ public class RepositoryService extends GitHubService {
* @throws IOException
*/
public List<Repository> getRepositories() throws IOException {
- PagedRequest<Repository> request = createPagedRequest();
+ return getAll(pageRepositories());
+ }
+
+ /**
+ * Page repositories for currently authenticated user
+ *
+ * @return iterator over pages of repositories
+ * @throws IOException
+ */
+ public PageIterator<Repository> pageRepositories() throws IOException {
+ return pageRepositories(PAGE_SIZE);
+ }
+
+ /**
+ * Page repositories for currently authenticated user
+ *
+ * @param size
+ * @return iterator over pages of repositories
+ * @throws IOException
+ */
+ public PageIterator<Repository> pageRepositories(int size)
+ throws IOException {
+ return pageRepositories(PAGE_FIRST, size);
+ }
+
+ /**
+ * Page repositories for currently authenticated user
+ *
+ * @param start
+ * @param size
+ * @return iterator over pages of repositories
+ * @throws IOException
+ */
+ public PageIterator<Repository> pageRepositories(int start, int size)
+ throws IOException {
+ PagedRequest<Repository> request = createPagedRequest(start, size);
request.setUri(SEGMENT_USER + SEGMENT_REPOS);
request.setType(new TypeToken<List<Repository>>() {
}.getType());
- return getAll(request);
+ return createPageIterator(request);
}
/**
@@ -120,6 +155,45 @@ public class RepositoryService extends GitHubService {
* @throws IOException
*/
public List<Repository> getRepositories(String user) throws IOException {
+ return getAll(pageRepositories(user));
+ }
+
+ /**
+ * Page repositories for given user
+ *
+ * @param user
+ * @return iterator over pages of repositories
+ * @throws IOException
+ */
+ public PageIterator<Repository> pageRepositories(String user)
+ throws IOException {
+ return pageRepositories(user, PAGE_SIZE);
+ }
+
+ /**
+ * Page repositories for given user
+ *
+ * @param user
+ * @param size
+ * @return iterator over pages of repositories
+ * @throws IOException
+ */
+ public PageIterator<Repository> pageRepositories(String user, int size)
+ throws IOException {
+ return pageRepositories(user, PAGE_FIRST, size);
+ }
+
+ /**
+ * Page repositories for given user
+ *
+ * @param user
+ * @param start
+ * @param size
+ * @return iterator over repository page
+ * @throws IOException
+ */
+ public PageIterator<Repository> pageRepositories(String user, int start,
+ int size) throws IOException {
if (user == null)
throw new IllegalArgumentException("User cannot be null"); //$NON-NLS-1$
if (user.length() == 0)
@@ -128,11 +202,11 @@ public class RepositoryService extends GitHubService {
StringBuilder uri = new StringBuilder(SEGMENT_USERS);
uri.append('/').append(user);
uri.append(SEGMENT_REPOS);
- PagedRequest<Repository> request = createPagedRequest();
+ PagedRequest<Repository> request = createPagedRequest(start, size);
request.setUri(uri);
request.setType(new TypeToken<List<Repository>>() {
}.getType());
- return getAll(request);
+ return createPageIterator(request);
}
/**
@@ -144,6 +218,41 @@ public class RepositoryService extends GitHubService {
*/
public List<Repository> getOrgRepositories(String organization)
throws IOException {
+ return getAll(pageOrgRepositories(organization));
+ }
+
+ /**
+ * Page repositories for the given organization
+ *
+ * @param organization
+ * @return iterator over pages of repositories
+ */
+ public PageIterator<Repository> pageOrgRepositories(String organization) {
+ return pageOrgRepositories(organization, PAGE_SIZE);
+ }
+
+ /**
+ * Page repositories for the given organization
+ *
+ * @param organization
+ * @param size
+ * @return iterator over pages of repositories
+ */
+ public PageIterator<Repository> pageOrgRepositories(String organization,
+ int size) {
+ return pageOrgRepositories(organization, PAGE_FIRST, size);
+ }
+
+ /**
+ * Page repositories for the given organization
+ *
+ * @param organization
+ * @param start
+ * @param size
+ * @return iterator over pages of repositories
+ */
+ public PageIterator<Repository> pageOrgRepositories(String organization,
+ int start, int size) {
if (organization == null)
throw new IllegalArgumentException("Organization cannot be null"); //$NON-NLS-1$
if (organization.length() == 0)
@@ -152,15 +261,18 @@ public class RepositoryService extends GitHubService {
StringBuilder uri = new StringBuilder(SEGMENT_ORGS);
uri.append('/').append(organization);
uri.append(SEGMENT_REPOS);
- PagedRequest<Repository> request = createPagedRequest();
+ PagedRequest<Repository> request = createPagedRequest(start, size);
request.setUri(uri);
request.setType(new TypeToken<List<Repository>>() {
}.getType());
- return getAll(request);
+ return createPageIterator(request);
}
/**
- * Search repositories
+ * Search for repositories matching query.
+ *
+ * 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
@@ -172,7 +284,10 @@ public class RepositoryService extends GitHubService {
}
/**
- * Search for repositories matching language and query
+ * Search for repositories matching language and query.
+ *
+ * This method requires an API v2 configured {@link GitHubClient} as it is
+ * not yet supported in API v3 clients.
*
* @param query
* @param language
@@ -181,6 +296,11 @@ public class RepositoryService extends GitHubService {
*/
public List<SearchRepository> searchRepositories(final String query,
final String language) throws IOException {
+ 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_V2_API);
uri.append(SEGMENT_REPOS);
uri.append(SEGMENT_SEARCH);
@@ -188,8 +308,8 @@ public class RepositoryService extends GitHubService {
PagedRequest<SearchRepository> request = createPagedRequest();
if (language != null && language.length() > 0)
- request.setParams(Collections.singletonMap(
- IGitHubConstants.PARAM_LANGUAGE, language));
+ request.setParams(Collections
+ .singletonMap(PARAM_LANGUAGE, language));
request.setUri(uri);
request.setType(RepositoryContainer.class);
@@ -224,6 +344,8 @@ public class RepositoryService extends GitHubService {
Repository repository) throws IOException {
if (organization == null)
throw new IllegalArgumentException("Organization cannot be null"); //$NON-NLS-1$
+ if (organization.length() == 0)
+ throw new IllegalArgumentException("Organization cannot be empty"); //$NON-NLS-1$
if (repository == null)
throw new IllegalArgumentException("Repository cannot be null"); //$NON-NLS-1$
@@ -292,9 +414,7 @@ public class RepositoryService extends GitHubService {
*/
public List<Repository> getForks(IRepositoryIdProvider repository)
throws IOException {
- PagedRequest<Repository> request = createPagedForkRequest(repository,
- PAGE_FIRST, PAGE_SIZE);
- return getAll(request);
+ return getAll(pageForks(repository));
}
/**
diff --git a/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/util/LabelComparator.java b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/util/LabelComparator.java
index 535e1662..346c4644 100644
--- a/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/util/LabelComparator.java
+++ b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/util/LabelComparator.java
@@ -15,7 +15,6 @@ import java.util.Comparator;
import org.eclipse.egit.github.core.Label;
-
/**
* Label comparator using case-insensitive name comparisons.
*/
diff --git a/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/util/UrlUtils.java b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/util/UrlUtils.java
index 9c7f7720..62e2f9e0 100644
--- a/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/util/UrlUtils.java
+++ b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/util/UrlUtils.java
@@ -57,7 +57,7 @@ public abstract class UrlUtils {
*/
public static String createRemoteSshUrl(IRepositoryIdProvider repository,
String host) {
- return "git@" + host + ":" + repository.generateId() + SUFFIX_GIT;
+ return "git@" + host + ":" + repository.generateId() + SUFFIX_GIT; //$NON-NLS-1$ //$NON-NLS-2$
}
/**
@@ -82,7 +82,7 @@ public abstract class UrlUtils {
*/
public static String createRemoteHttpsUrl(IRepositoryIdProvider repository,
String host, String user) {
- return "https://" + user + "@" + host + "/" + repository.generateId()
+ return "https://" + user + "@" + host + "/" + repository.generateId() //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ SUFFIX_GIT;
}
@@ -106,6 +106,6 @@ public abstract class UrlUtils {
*/
public static String createRemoteReadOnlyUrl(
IRepositoryIdProvider repository, String host) {
- return "git://" + host + "/" + repository.generateId() + SUFFIX_GIT;
+ return "git://" + host + "/" + repository.generateId() + SUFFIX_GIT; //$NON-NLS-1$ //$NON-NLS-2$
}
}
diff --git a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/internal/github/core/GitHubException.java b/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/internal/github/core/GitHubException.java
index c6bde874..54952fd2 100644
--- a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/internal/github/core/GitHubException.java
+++ b/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/internal/github/core/GitHubException.java
@@ -23,15 +23,13 @@ import org.eclipse.egit.github.core.client.RequestException;
*/
public class GitHubException extends IOException {
- /**
- *
- */
+ /** serialVersionUID */
private static final long serialVersionUID = -1456910662911777231L;
/**
* Wraps the given {@link IOException} with a {@link GitHubException} if it
* is a {@link RequestException} instance.
- *
+ *
* @param exception
* @return wrapped exception
*/
@@ -42,7 +40,7 @@ public class GitHubException extends IOException {
/**
* Create GitHub exception from {@link RequestException}
- *
+ *
* @param cause
*/
public GitHubException(RequestException cause) {
@@ -70,6 +68,7 @@ public class GitHubException extends IOException {
String value = error.getValue();
String field = error.getField();
String resource = error.getResource();
+
if (FieldError.CODE_INVALID.equals(code))
if (value != null)
return MessageFormat
@@ -77,13 +76,18 @@ public class GitHubException extends IOException {
value, field);
else
return MessageFormat.format(Messages.FieldError_InvalidField,
- field, value);
- else if (FieldError.CODE_MISSING_FIELD.equals(code))
+ field);
+
+ if (FieldError.CODE_MISSING_FIELD.equals(code))
return MessageFormat
.format(Messages.FieldError_MissingField, field);
- else
- return MessageFormat.format(Messages.FieldError_ResourceError,
- field, resource);
- }
+ if (FieldError.CODE_ALREADY_EXISTS.equals(code))
+ return MessageFormat.format(
+ Messages.FieldError_AlreadyExists,
+ resource, field);
+
+ return MessageFormat.format(Messages.FieldError_ResourceError, field,
+ resource);
+ }
}
diff --git a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/internal/github/core/Messages.java b/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/internal/github/core/Messages.java
index 0c8858bf..60ae28f3 100644
--- a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/internal/github/core/Messages.java
+++ b/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/internal/github/core/Messages.java
@@ -31,6 +31,9 @@ public class Messages extends NLS {
/** */
public static String FieldError_ResourceError;
+ /** */
+ public static String FieldError_AlreadyExists;
+
static {
// initialize resource bundle
NLS.initializeMessages(BUNDLE_NAME, Messages.class);
diff --git a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/internal/github/core/issue/IssueTaskDataHandler.java b/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/internal/github/core/issue/IssueTaskDataHandler.java
index 83c883f8..5c2f4811 100644
--- a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/internal/github/core/issue/IssueTaskDataHandler.java
+++ b/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/internal/github/core/issue/IssueTaskDataHandler.java
@@ -350,17 +350,10 @@ public class IssueTaskDataHandler extends GitHubTaskDataHandler {
if (operationAttribute != null) {
IssueOperation operation = IssueOperation
.fromId(operationAttribute.getValue());
- if (operation != IssueOperation.LEAVE)
- switch (operation) {
- case REOPEN:
- issue.setState(IssueService.STATE_OPEN);
- break;
- case CLOSE:
- issue.setState(IssueService.STATE_CLOSED);
- break;
- default:
- break;
- }
+ if (operation == IssueOperation.REOPEN)
+ issue.setState(IssueService.STATE_OPEN);
+ else if (operation == IssueOperation.CLOSE)
+ issue.setState(IssueService.STATE_CLOSED);
}
service.editIssue(repo.getOwner(), repo.getName(), issue);
}
diff --git a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/internal/github/core/messages.properties b/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/internal/github/core/messages.properties
index 52d8a86a..4a6d017d 100644
--- a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/internal/github/core/messages.properties
+++ b/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/internal/github/core/messages.properties
@@ -1,4 +1,5 @@
-FieldError_InvalidField=Invalid value for field {1}
-FieldError_InvalidFieldWithValue=Invalid value of {0} for field {1}
-FieldError_MissingField=Missing required field {0}
-FieldError_ResourceError=Error with field {0} in {1} resource
+FieldError_InvalidField=Invalid value for ''{0}'' field
+FieldError_InvalidFieldWithValue=Invalid value of ''{0}'' for ''{1}'' field
+FieldError_MissingField=Missing required ''{0}'' field
+FieldError_ResourceError=Error with ''{0}'' field in {1} resource
+FieldError_AlreadyExists={0} resource with ''{1}'' field already exists
diff --git a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/internal/github/core/pr/PullRequestTaskDataHandler.java b/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/internal/github/core/pr/PullRequestTaskDataHandler.java
index a0dd2fa7..c0816077 100644
--- a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/internal/github/core/pr/PullRequestTaskDataHandler.java
+++ b/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/internal/github/core/pr/PullRequestTaskDataHandler.java
@@ -44,7 +44,7 @@ public class PullRequestTaskDataHandler extends GitHubTaskDataHandler {
/**
* Create GitHub issue task data handler for connector
- *
+ *
* @param connector
*/
public PullRequestTaskDataHandler(PullRequestConnector connector) {
@@ -52,7 +52,7 @@ public class PullRequestTaskDataHandler extends GitHubTaskDataHandler {
/**
* Create task data for pull request
- *
+ *
* @param repository
* @param monitor
* @param repo
@@ -108,6 +108,10 @@ public class PullRequestTaskDataHandler extends GitHubTaskDataHandler {
if (data.isNew())
return;
+ // Merged pull requests cannot be reopened
+ if (pr.isMerged())
+ return;
+
String state = pr.getState();
if (state != null) {
addOperation(data, pr, PullRequestOperation.LEAVE, true);
@@ -133,7 +137,7 @@ public class PullRequestTaskDataHandler extends GitHubTaskDataHandler {
/**
* Create task data for pull request
- *
+ *
* @param repository
* @param monitor
* @param repo
@@ -210,17 +214,10 @@ public class PullRequestTaskDataHandler extends GitHubTaskDataHandler {
if (operationAttribute != null) {
PullRequestOperation operation = PullRequestOperation
.fromId(operationAttribute.getValue());
- if (operation != PullRequestOperation.LEAVE)
- switch (operation) {
- case REOPEN:
- pr.setState(IssueService.STATE_OPEN);
- break;
- case CLOSE:
- pr.setState(IssueService.STATE_CLOSED);
- break;
- default:
- break;
- }
+ if (operation == PullRequestOperation.REOPEN)
+ pr.setState(IssueService.STATE_OPEN);
+ else if (operation == PullRequestOperation.CLOSE)
+ pr.setState(IssueService.STATE_CLOSED);
}
prService.editPullRequest(repo, pr);
}
diff --git a/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/internal/github/ui/pr/CommitAttributePart.java b/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/internal/github/ui/pr/CommitAttributePart.java
index eec5663e..09db05af 100644
--- a/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/internal/github/ui/pr/CommitAttributePart.java
+++ b/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/internal/github/ui/pr/CommitAttributePart.java
@@ -15,6 +15,7 @@ import java.text.MessageFormat;
import org.eclipse.core.commands.common.CommandException;
import org.eclipse.core.expressions.IEvaluationContext;
+import org.eclipse.egit.github.core.PullRequest;
import org.eclipse.egit.ui.UIIcons;
import org.eclipse.egit.ui.UIUtils;
import org.eclipse.egit.ui.internal.commit.CommitEditor;
@@ -132,10 +133,13 @@ public class CommitAttributePart extends AbstractTaskEditorSection {
commitViewer.addOpenListener(new IOpenListener() {
public void open(final OpenEvent event) {
- Repository repo = PullRequestUtils.getRepository(request
- .getRequest());
- openCommits(repo,
- ((IStructuredSelection) event.getSelection()).toArray());
+ PullRequest pr = request.getRequest();
+ Repository repo = PullRequestUtils.getRepository(pr);
+ if (repo != null)
+ openCommits(repo, ((IStructuredSelection) event
+ .getSelection()).toArray());
+ else
+ PullRequestConnectorUi.showNoRepositoryDialog(pr);
}
});
diff --git a/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/internal/github/ui/pr/FetchPullRequestHandler.java b/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/internal/github/ui/pr/FetchPullRequestHandler.java
index f0a2fca1..0f505a6c 100644
--- a/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/internal/github/ui/pr/FetchPullRequestHandler.java
+++ b/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/internal/github/ui/pr/FetchPullRequestHandler.java
@@ -67,8 +67,10 @@ public class FetchPullRequestHandler extends TaskDataHandler {
return Status.CANCEL_STATUS;
PullRequest request = prComp.getRequest();
Repository repo = PullRequestUtils.getRepository(request);
- if (repo == null)
+ if (repo == null) {
+ PullRequestConnectorUi.showNoRepositoryDialog(request);
return Status.CANCEL_STATUS;
+ }
RemoteConfig remote = PullRequestUtils.addRemote(repo,
request);
new FetchOperationUI(repo, remote, Activator.getDefault()
diff --git a/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/internal/github/ui/pr/Messages.java b/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/internal/github/ui/pr/Messages.java
index 52b2a664..43292df5 100644
--- a/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/internal/github/ui/pr/Messages.java
+++ b/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/internal/github/ui/pr/Messages.java
@@ -46,6 +46,10 @@ public class Messages extends NLS {
/** */
public static String FetchPullRequestHandler_JobName;
/** */
+ public static String PullRequestConnectorUi_MessageRepositoryNotFound;
+ /** */
+ public static String PullRequestConnectorUi_TitleRepositoryNotFound;
+ /** */
public static String MergePullRequestHandler_MergeJob;
/** */
public static String MergePullRequestHandler_TaskCheckout;
diff --git a/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/internal/github/ui/pr/PullRequestConnectorUi.java b/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/internal/github/ui/pr/PullRequestConnectorUi.java
index 20dacef8..497a22e5 100644
--- a/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/internal/github/ui/pr/PullRequestConnectorUi.java
+++ b/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/internal/github/ui/pr/PullRequestConnectorUi.java
@@ -10,6 +10,11 @@
*****************************************************************************/
package org.eclipse.mylyn.internal.github.ui.pr;
+import java.text.MessageFormat;
+
+import org.eclipse.egit.github.core.PullRequest;
+import org.eclipse.egit.github.core.Repository;
+import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.wizard.IWizard;
import org.eclipse.mylyn.internal.github.core.pr.PullRequestConnector;
import org.eclipse.mylyn.tasks.core.IRepositoryQuery;
@@ -20,12 +25,39 @@ import org.eclipse.mylyn.tasks.ui.AbstractRepositoryConnectorUi;
import org.eclipse.mylyn.tasks.ui.wizards.ITaskRepositoryPage;
import org.eclipse.mylyn.tasks.ui.wizards.NewTaskWizard;
import org.eclipse.mylyn.tasks.ui.wizards.RepositoryQueryWizard;
+import org.eclipse.ui.PlatformUI;
/**
* Pull request connector UI
*/
public class PullRequestConnectorUi extends AbstractRepositoryConnectorUi {
+ /**
+ * Show informational dialog for when a pull request cannot be resolved to a
+ * Git repository.
+ *
+ * @param request
+ * must be non-null
+ */
+ public static void showNoRepositoryDialog(PullRequest request) {
+ Repository remoteRepo = request.getBase().getRepo();
+ String id = remoteRepo.getOwner().getLogin() + '/'
+ + remoteRepo.getName();
+ final String message = MessageFormat.format(
+ Messages.PullRequestConnectorUi_MessageRepositoryNotFound, id);
+ PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() {
+
+ public void run() {
+ MessageDialog
+ .openInformation(
+ PlatformUI.getWorkbench().getDisplay()
+ .getActiveShell(),
+ Messages.PullRequestConnectorUi_TitleRepositoryNotFound,
+ message);
+ }
+ });
+ }
+
public String getConnectorKind() {
return PullRequestConnector.KIND;
}
diff --git a/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/internal/github/ui/pr/messages.properties b/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/internal/github/ui/pr/messages.properties
index 7c6c91a9..f924559a 100644
--- a/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/internal/github/ui/pr/messages.properties
+++ b/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/internal/github/ui/pr/messages.properties
@@ -11,6 +11,8 @@ CommitAttributePart_PartName=Commits
CommitAttributePart_SectionCommits=Commits ({0})
CommitAttributePart_TitleFetch=Fetch commits
FetchPullRequestHandler_JobName=Pulling from pull request {0}
+PullRequestConnectorUi_MessageRepositoryNotFound=The Git repository for ''{0}'' was not found.\n\nPlease add or clone it using the Git Repositories view.
+PullRequestConnectorUi_TitleRepositoryNotFound=Git Repository Not Found
MergePullRequestHandler_MergeJob=Merging pull request {0}
MergePullRequestHandler_TaskCheckout=Checking out {0} branch
MergePullRequestHandler_TaskMerge=Merging {0} branch into {1} branch
diff --git a/pom.xml b/pom.xml
index 74ef1329..f16fca05 100644
--- a/pom.xml
+++ b/pom.xml
@@ -184,7 +184,7 @@
<plugin>
<groupId>org.eclipse.dash.maven</groupId>
<artifactId>eclipse-signing-maven-plugin</artifactId>
- <version>1.0.2</version>
+ <version>1.0.3</version>
</plugin>
</plugins>
</pluginManagement>

Back to the top