Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Rebert2015-03-04 09:58:17 +0000
committerChris Rebert2015-03-04 09:58:17 +0000
commit7f02b89a2a6bb78942c695317657c081e5b310ce (patch)
treecb4392bafd131d250b26252eb8b0a022168a0303
parentf1d59a3fbc06d7df00910d84eaff988cd8b12ea4 (diff)
downloadegit-github-7f02b89a2a6bb78942c695317657c081e5b310ce.tar.gz
egit-github-7f02b89a2a6bb78942c695317657c081e5b310ce.tar.xz
egit-github-7f02b89a2a6bb78942c695317657c081e5b310ce.zip
Added `context` field to the CommitStatus class
Relevant GitHub API docs: https://developer.github.com/v3/repos/statuses/ This field is used to indicate the service that provided the commit status in question. Its value is an (apparently arbitrary) string with a default value of "default". Conventionally, the value should be of the form "generic-category/specific-service", as in "continuous-integration/jenkins" or "security/brakeman". Bug: 461351 Change-Id: Ifef4e369c4d602ac6a5d1f12c399d059052b8abc Signed-off-by: Chris Rebert <eclipse@rebertia.com>
-rw-r--r--org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/CommitStatusTest.java4
-rw-r--r--org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/CommitStatus.java20
2 files changed, 22 insertions, 2 deletions
diff --git a/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/CommitStatusTest.java b/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/CommitStatusTest.java
index 0abb0275..bdd85220 100644
--- a/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/CommitStatusTest.java
+++ b/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/CommitStatusTest.java
@@ -1,5 +1,5 @@
/******************************************************************************
- * Copyright (c) 2012 GitHub Inc.
+ * Copyright (c) 2012, 2015 GitHub Inc. and others.
* 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
@@ -32,6 +32,7 @@ public class CommitStatusTest {
CommitStatus status = new CommitStatus();
assertNull(status.getCreatedAt());
assertNull(status.getCreator());
+ assertNull(status.getContext());
assertNull(status.getDescription());
assertEquals(0, status.getId());
assertNull(status.getState());
@@ -50,6 +51,7 @@ public class CommitStatusTest {
.getCreatedAt());
User creator = new User().setId(1);
assertEquals(creator, status.setCreator(creator).getCreator());
+ assertEquals("con/text", status.setContext("con/text").getContext());
assertEquals("desc", status.setDescription("desc").getDescription());
assertEquals(40, status.setId(40).getId());
assertEquals("state", status.setState("state").getState());
diff --git a/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/CommitStatus.java b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/CommitStatus.java
index fde7bdbb..b6df83e4 100644
--- a/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/CommitStatus.java
+++ b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/CommitStatus.java
@@ -1,5 +1,5 @@
/******************************************************************************
- * Copyright (c) 2012 GitHub Inc.
+ * Copyright (c) 2012, 2015 GitHub Inc. and others.
* 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
@@ -48,6 +48,8 @@ public class CommitStatus implements Serializable {
private long id;
+ private String context;
+
private String description;
private String state;
@@ -107,6 +109,22 @@ public class CommitStatus implements Serializable {
}
/**
+ * @return context
+ */
+ public String getContext() {
+ return context;
+ }
+
+ /**
+ * @param context
+ * @return this status
+ */
+ public CommitStatus setContext(final String context) {
+ this.context = context;
+ return this;
+ }
+
+ /**
* @return description
*/
public String getDescription() {

Back to the top