Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron S. Hawley2019-06-21 06:22:55 -0400
committerThomas Wolf2019-06-21 14:22:21 -0400
commit2565bf7ae358f156fcac7f5d007dc7cd4bf7e2d8 (patch)
tree21042aed79de03cda8abcf2a0b02d6513948beb0
parent7a8c24d36f2214f6d7a97bb09249974d978188fe (diff)
downloadegit-github-2565bf7ae358f156fcac7f5d007dc7cd4bf7e2d8.tar.gz
egit-github-2565bf7ae358f156fcac7f5d007dc7cd4bf7e2d8.tar.xz
egit-github-2565bf7ae358f156fcac7f5d007dc7cd4bf7e2d8.zip
Change mergeable in PullRequest to Boolean
According to [1], mergeable field needs to be a null-able reference type, and not a boolean primitive: The value of the mergeable attribute can be true, false, or null. If the value is null, then GitHub has started a background job to compute the mergeability. After giving the job time to complete, resubmit the request. When the job finishes, you will see a non-null value for the mergeable attribute in the response. [1] https://developer.github.com/v3/pulls/#response-1 Bug: 537774 Change-Id: I0cfb83933afb18386a2390138c738ce78d700a18 Signed-off-by: Aaron S. Hawley <aaron.s.hawley@gmail.com>
-rwxr-xr-xorg.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/PullRequestTest.java2
-rw-r--r--org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/PullRequest.java17
2 files changed, 14 insertions, 5 deletions
diff --git a/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/PullRequestTest.java b/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/PullRequestTest.java
index 6245e7c1..86c833b1 100755
--- a/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/PullRequestTest.java
+++ b/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/PullRequestTest.java
@@ -39,7 +39,7 @@ public class PullRequestTest {
@Test
public void defaultState() {
PullRequest request = new PullRequest();
- assertFalse(request.isMergeable());
+ assertNull(request.isMergeable());
assertFalse(request.isMerged());
assertEquals(0, request.getAdditions());
assertNull(request.getBase());
diff --git a/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/PullRequest.java b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/PullRequest.java
index ec078782..2df4f767 100644
--- a/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/PullRequest.java
+++ b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/PullRequest.java
@@ -26,7 +26,7 @@ public class PullRequest implements Serializable {
/** serialVersionUID */
private static final long serialVersionUID = 7858604768525096763L;
- private boolean mergeable;
+ private Boolean mergeable;
private boolean merged;
@@ -89,9 +89,18 @@ public class PullRequest implements Serializable {
private List<User> assignees;
/**
- * @return mergeable
+ * Tells whether the pull request can be merged. The value may be
+ * {@code null}, which indicates that GitHub is busy computing this
+ * information but hasn't determined it yet.
+ *
+ * @return whether the pull request is mergeable, or {@code null} if not
+ * known yet and GitHub is busy calculating the mergeability.
+ *
+ * @see <a href=
+ * "https://developer.github.com/v3/pulls/#get-a-single-pull-request">GitHub
+ * Rest API v3: Pull Requests</a>
*/
- public boolean isMergeable() {
+ public Boolean isMergeable() {
return mergeable;
}
@@ -99,7 +108,7 @@ public class PullRequest implements Serializable {
* @param mergeable
* @return this pull request
*/
- public PullRequest setMergeable(boolean mergeable) {
+ public PullRequest setMergeable(Boolean mergeable) {
this.mergeable = mergeable;
return this;
}

Back to the top