diff options
7 files changed, 61 insertions, 19 deletions
diff --git a/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/GistTest.java b/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/GistTest.java index 91c71c81..e03248c1 100644 --- a/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/GistTest.java +++ b/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/GistTest.java @@ -47,6 +47,7 @@ public class GistTest { assertNull(gist.getUpdatedAt()); assertNull(gist.getUrl()); assertNull(gist.getUser()); + assertNull(gist.getOwner()); assertFalse(gist.isPublic()); } 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 265cf104..5506d231 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 @@ -40,7 +40,7 @@ public class RepositoryTest { assertNull(repo.getHomepage()); assertNull(repo.getHtmlUrl()); assertNull(repo.getLanguage()); - assertNull(repo.getMasterBranch()); + assertNull(repo.getDefaultBranch()); assertNull(repo.getMirrorUrl()); assertNull(repo.getName()); assertEquals(0, repo.getOpenIssues()); @@ -77,7 +77,7 @@ public class RepositoryTest { assertEquals("home", repo.setHomepage("home").getHomepage()); assertEquals("html", repo.setHtmlUrl("html").getHtmlUrl()); assertEquals("java", repo.setLanguage("java").getLanguage()); - assertEquals("master", repo.setMasterBranch("master").getMasterBranch()); + assertEquals("master", repo.setDefaultBranch("master").getDefaultBranch()); assertEquals("project", repo.setName("project").getName()); assertEquals(20, repo.setOpenIssues(20).getOpenIssues()); User owner = new User().setLogin("owner"); diff --git a/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/Gist.java b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/Gist.java index 058a0d1b..bf269948 100644 --- a/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/Gist.java +++ b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/Gist.java @@ -52,7 +52,7 @@ public class Gist implements Serializable { private String url; - private User user; + private User owner; /** * @return isPublic @@ -247,18 +247,36 @@ public class Gist implements Serializable { } /** + * @return owner + */ + public User getOwner() { + return owner; + } + + /** + * @param owner + * @return this gist + */ + public Gist setOwner(User owner) { + this.owner = owner; + return this; + } + + /** * @return user */ + @Deprecated public User getUser() { - return user; + return owner; } /** * @param user * @return this gist */ + @Deprecated public Gist setUser(User user) { - this.user = user; + this.owner = user; return this; } } 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 a60c7afc..c84ee587 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 @@ -68,7 +68,7 @@ public class Repository implements IRepositoryIdProvider, Serializable { private String language; - private String masterBranch; + private String defaultBranch; private String mirrorUrl; @@ -387,18 +387,36 @@ public class Repository implements IRepositoryIdProvider, Serializable { } /** - * @return masterBranch + * @return defaultBranch + */ + public String getDefaultBranch() { + return defaultBranch; + } + + /** + * @param defaultBranch + * @return this repository */ + public Repository setDefaultBranch(String defaultBranch) { + this.defaultBranch = defaultBranch; + return this; + } + + /** + * @return masterBranch + */ + @Deprecated public String getMasterBranch() { - return masterBranch; + return defaultBranch; } /** * @param masterBranch * @return this repository */ + @Deprecated public Repository setMasterBranch(String masterBranch) { - this.masterBranch = masterBranch; + this.defaultBranch = masterBranch; return this; } 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 a5c1fe48..dee4218d 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 @@ -31,6 +31,7 @@ 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_V3_API; +import static org.eclipse.egit.github.core.service.GitHubService.ACCEPT_DEFAULT; import com.google.gson.Gson; import com.google.gson.JsonParseException; @@ -227,8 +228,7 @@ public class GitHubClient { if (credentials != null) request.setRequestProperty(HEADER_AUTHORIZATION, credentials); request.setRequestProperty(HEADER_USER_AGENT, userAgent); - request.setRequestProperty(HEADER_ACCEPT, - "application/vnd.github.beta+json"); //$NON-NLS-1$ + request.setRequestProperty(HEADER_ACCEPT, ACCEPT_DEFAULT); return request; } 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 73ac32d3..19412107 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 @@ -32,19 +32,24 @@ import org.eclipse.egit.github.core.client.RequestException; public abstract class GitHubService { /** + * Accept header for default response + */ + public static final String ACCEPT_DEFAULT = "application/vnd.github.v3+json"; //$NON-NLS-1$ + + /** * Accept header for full response */ - protected static final String ACCEPT_FULL = "application/vnd.github.beta.full+json"; //$NON-NLS-1$ + public static final String ACCEPT_FULL = "application/vnd.github.v3.full+json"; //$NON-NLS-1$ /** * Accept header for HTML response */ - protected static final String ACCEPT_HTML = "application/vnd.github.beta.html+json"; //$NON-NLS-1$ + public static final String ACCEPT_HTML = "application/vnd.github.v3.html+json"; //$NON-NLS-1$ /** * Accept header for text response */ - protected static final String ACCEPT_TEXT = "application/vnd.github.beta.text+json"; //$NON-NLS-1$ + public static final String ACCEPT_TEXT = "application/vnd.github.v3.text+json"; //$NON-NLS-1$ /** * Client field diff --git a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/internal/github/core/gist/GistTaskDataHandler.java b/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/internal/github/core/gist/GistTaskDataHandler.java index e2e92a3f..de626e74 100644 --- a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/internal/github/core/gist/GistTaskDataHandler.java +++ b/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/internal/github/core/gist/GistTaskDataHandler.java @@ -84,7 +84,7 @@ public class GistTaskDataHandler extends GitHubTaskDataHandler { */ public TaskData fillTaskData(TaskRepository repository, TaskData data, Gist gist) { - boolean isOwner = isOwner(repository, gist.getUser()); + boolean isOwner = isOwner(repository, gist.getOwner()); TaskAttributeMapper mapper = data.getAttributeMapper(); TaskAttribute key = GistAttribute.KEY.getMetadata().create(data); @@ -116,16 +116,16 @@ public class GistTaskDataHandler extends GitHubTaskDataHandler { cloneUrl.setValue(gist.getGitPullUrl()); IRepositoryPerson reporterPerson = null; - User user = gist.getUser(); - if (user != null) { + User owner = gist.getOwner(); + if (owner != null) { TaskAttribute reporter = GistAttribute.AUTHOR.getMetadata().create( data); - reporterPerson = createPerson(user, repository); + reporterPerson = createPerson(owner, repository); mapper.setRepositoryPerson(reporter, reporterPerson); TaskAttribute gravatar = GistAttribute.AUTHOR_GRAVATAR .getMetadata().create(data); - mapper.setValue(gravatar, user.getAvatarUrl()); + mapper.setValue(gravatar, owner.getAvatarUrl()); } Map<String, GistFile> files = gist.getFiles(); |