-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added support for merging pull requests and checking a pull requests …
…status via the API. (#38) * Added merge function to the pull request api. * Added Fetching of 'pull-request merge status' and 'pull request merging' to the api. Modified HttpCommunication worker exception handling so it added the response from the server to any exceptions that occur during parsing. * Created pull-request status and merging test cases however the current test setup is not appropriate for pull-request merging so the merge test checks two different cases a merge and a failed merge. Added specific exception for failed merges. * Renamed Test case to match existing style.
- Loading branch information
Showing
9 changed files
with
196 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
using Newtonsoft.Json; | ||
|
||
namespace Atlassian.Stash.Api.Entities | ||
{ | ||
public class MergeErrorResponse | ||
{ | ||
[JsonProperty("errors")] | ||
public IEnumerable<MergeError> Errors { get; set; } | ||
} | ||
|
||
public class MergeError | ||
{ | ||
[JsonProperty("context")] | ||
public string Context { get; set; } | ||
[JsonProperty("message")] | ||
public string Message { get; set; } | ||
[JsonProperty("exceptionName")] | ||
public string ExceptionName { get; set; } | ||
[JsonProperty("conflicted")] | ||
public bool Conflicted { get; set; } | ||
[JsonProperty("vetoes")] | ||
public IEnumerable<Vetoe> Vetoes { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Runtime.Serialization; | ||
using System.Text; | ||
using Atlassian.Stash.Entities; | ||
using Newtonsoft.Json; | ||
|
||
namespace Atlassian.Stash.Api.Entities | ||
{ | ||
public class PullRequestStatus | ||
{ | ||
[JsonProperty("canMerge")] | ||
public bool CanMerge { get; set; } | ||
|
||
[JsonProperty("conflicted")] | ||
public bool RequiredAllApprovers { get; set; } | ||
|
||
[JsonProperty("outcome")] | ||
public string Outcome { get; set; } | ||
|
||
[JsonProperty("vetoes")] | ||
public IEnumerable<Vetoe> Vetoes { get; set; } | ||
} | ||
|
||
public class Vetoe | ||
{ | ||
[JsonProperty("summaryMessage")] | ||
public string SummaryMessage { get; set; } | ||
|
||
[JsonProperty("detailedMessage")] | ||
public string DetailedMessage { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
using Atlassian.Stash.Api.Entities; | ||
|
||
namespace Atlassian.Stash.Api.Exceptions | ||
{ | ||
public class StashMergeException : Exception | ||
{ | ||
public MergeErrorResponse ErrorResponse { get; set; } | ||
|
||
public StashMergeException(string message, Exception exc, MergeErrorResponse response) : base(message,exc) | ||
{ | ||
ErrorResponse = response; | ||
} | ||
|
||
public StashMergeException(string message, MergeErrorResponse response) : base(message) | ||
{ | ||
ErrorResponse = response; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters