From 5cf47f0645290398e7c330ad32bc38aede2ac35f Mon Sep 17 00:00:00 2001 From: Philippe Miossec Date: Fri, 1 Mar 2019 13:03:58 +0100 Subject: [PATCH] Being able to navigate to a PR page of an AppVeyor build --- GitUI/GitUI.csproj | 1 + GitUI/Properties/Images.Designer.cs | 10 +++++++ GitUI/Properties/Images.resx | 3 +++ GitUI/Resources/Icons/PullRequest.png | Bin 0 -> 695 bytes .../RevisionGridControl.Designer.cs | 14 +++++++++- .../RevisionGrid/RevisionGridControl.cs | 12 +++++++++ .../AppVeyorIntegration/AppVeyorAdapter.cs | 25 +++++++++++++++++- .../BuildServerIntegration/BuildInfo.cs | 1 + 8 files changed, 64 insertions(+), 2 deletions(-) create mode 100644 GitUI/Resources/Icons/PullRequest.png diff --git a/GitUI/GitUI.csproj b/GitUI/GitUI.csproj index 2a8c32747d2..1402bce7cc6 100644 --- a/GitUI/GitUI.csproj +++ b/GitUI/GitUI.csproj @@ -1844,6 +1844,7 @@ + PreserveNewest diff --git a/GitUI/Properties/Images.Designer.cs b/GitUI/Properties/Images.Designer.cs index dc6654b8332..06e025c6404 100644 --- a/GitUI/Properties/Images.Designer.cs +++ b/GitUI/Properties/Images.Designer.cs @@ -1480,6 +1480,16 @@ public class Images { } } + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + public static System.Drawing.Bitmap PullRequest { + get { + object obj = ResourceManager.GetObject("PullRequest", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// diff --git a/GitUI/Properties/Images.resx b/GitUI/Properties/Images.resx index c6e2453051d..28cdd2400ce 100644 --- a/GitUI/Properties/Images.resx +++ b/GitUI/Properties/Images.resx @@ -799,4 +799,7 @@ ..\Resources\Icons\DocumentTree.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\Icons\PullRequest.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + \ No newline at end of file diff --git a/GitUI/Resources/Icons/PullRequest.png b/GitUI/Resources/Icons/PullRequest.png new file mode 100644 index 0000000000000000000000000000000000000000..33ec10881aca2a8e61e68d48e3d9d7c33ce55794 GIT binary patch literal 695 zcmV;o0!aOdP);&Sc`xIk?c@nUx-ok79`JWqd1M} z)d)BhgWGfZp5Qqil}Mg#y=W>*nC^lX@wqm!H)9E&p#z`FjR$N*cUk9o!WwvwEm2?# z`h?MRWCVURaio2?i0k;8^!<_lRdcaDL-0LAaxU>pMPzruGJHrxoG2>*4ky9=1%6o( z={D?6I4A2Q1mCP1`n}SnCGfd4*?WU(WI!yVf0UE z2xtgs2xtiS?*j6$9FI*r$wsid3XXQ6c*$}M3rBrLG~uam`W?qQp$K^?95(AqB%h79 zQS_0>u^;auZ(F6{j;QunVsFE5TrDA>Gjen$_6^bAQz`glbXuL$HxS!oI3GC{=kyKY zZq|@4!om1#N$gERy_i>c QueryBuildsResults(Project project) { try @@ -203,9 +221,13 @@ private IEnumerable QueryBuildsResults(Project project) return Enumerable.Empty(); } - var builds = JObject.Parse(result)["builds"].Children(); + var content = JObject.Parse(result); + var builds = content["builds"].Children(); var baseApiUrl = ApiBaseUrl + project.Id; var baseWebUrl = WebSiteUrl + "/project/" + project.Id + "/build/"; + var projectData = content["project"]; + var repositoryName = projectData["repositoryName"]; + var repositoryType = projectData["repositoryType"]; var buildDetails = new List(); foreach (var b in builds) @@ -239,6 +261,7 @@ private IEnumerable QueryBuildsResults(Project project) StartDate = b["started"]?.ToObject() ?? DateTime.MinValue, BaseWebUrl = baseWebUrl, Url = WebSiteUrl + "/project/" + project.Id + "/build/" + version, + PullRequestUrl = repositoryType != null && repositoryName != null && pullRequestId != null ? BuildPullRequetUrl(repositoryType.Value(), repositoryName.Value(), pullRequestId.Value()) : null, BaseApiUrl = baseApiUrl, AppVeyorBuildReportUrl = baseApiUrl + "/build/" + version, PullRequestText = pullRequestId != null ? "PR#" + pullRequestId.Value() : string.Empty, diff --git a/Plugins/GitUIPluginInterfaces/BuildServerIntegration/BuildInfo.cs b/Plugins/GitUIPluginInterfaces/BuildServerIntegration/BuildInfo.cs index c90f08aeac6..c28ec6bcda3 100644 --- a/Plugins/GitUIPluginInterfaces/BuildServerIntegration/BuildInfo.cs +++ b/Plugins/GitUIPluginInterfaces/BuildServerIntegration/BuildInfo.cs @@ -24,5 +24,6 @@ public enum BuildStatus public string Url { get; set; } public bool ShowInBuildReportTab { get; set; } = true; public string Tooltip { get; set; } + public string PullRequestUrl { get; set; } } } \ No newline at end of file