Replace the term "pull request" with "test merge"

Where possible without majorly breaking the DMAPI
This commit is contained in:
Jordan Brown
2020-12-09 22:26:54 -05:00
parent ebe5bdd55b
commit 2433b5733b
12 changed files with 41 additions and 29 deletions
+9 -9
View File
@@ -67,7 +67,7 @@
#define TGS_EVENT_REPO_CHECKOUT 1
/// When the repository performs a fetch operation. No parameters
#define TGS_EVENT_REPO_FETCH 2
/// When the repository merges a pull request. Parameters: PR Number, PR Sha, (Nullable) Comment made by TGS user
/// When the repository test merges. Parameters: PR Number, PR Sha, (Nullable) Comment made by TGS user
#define TGS_EVENT_REPO_MERGE_PULL_REQUEST 3
/// Before the repository makes a sychronize operation. Parameters: Absolute repostiory path
#define TGS_EVENT_REPO_PRE_SYNCHRONIZE 4
@@ -190,21 +190,21 @@
/// Represents a merge of a GitHub pull request.
/datum/tgs_revision_information/test_merge
/// The pull request number.
/// The test merge number.
var/number
/// The pull request title when it was merged.
/// The test merge source's title when it was merged.
var/title
/// The pull request body when it was merged.
/// The test merge source's body when it was merged.
var/body
/// The GitHub username of the pull request's author.
/// The Username of the test merge source's author.
var/author
/// An http URL to the pull request.
/// An http URL to the test merge source.
var/url
/// The SHA of the pull request when that was merged.
/// The SHA of the test merge when that was merged.
var/pull_request_commit
/// ISO 8601 timestamp of when the pull request was merged.
/// ISO 8601 timestamp of when the test merge was created on TGS.
var/time_merged
/// (Nullable) Comment left by the TGS user who initiated the merge..
/// Optional comment left by the TGS user who initiated the merge.
var/comment
/// Represents a connected chat channel.
+2 -2
View File
@@ -234,7 +234,7 @@ namespace Tgstation.Server.Api.Models
/// <summary>
/// <see cref="Repository.NewTestMerges"/> contained duplicate <see cref="TestMergeParameters.Number"/>s.
/// </summary>
[Description("The same pull request was present more than once in the test merge requests or is already merged!")]
[Description("The same test merge was present more than once or is already merged!")]
RepoDuplicateTestMerge,
/// <summary>
@@ -460,7 +460,7 @@ namespace Tgstation.Server.Api.Models
/// <summary>
/// Encounted merge conflicts while test merging.
/// </summary>
[Description("Encountered merge conflicts while test merging one or more pull requests!")]
[Description("Encountered merge conflicts while test merging one or more sources!")]
RepoTestMergeConflict,
/// <summary>
@@ -1,10 +1,10 @@
using System;
using System;
using System.ComponentModel.DataAnnotations;
namespace Tgstation.Server.Api.Models.Internal
{
/// <summary>
/// Represents a merge of a GitHub pull request
/// Represents a test merge of a remote "pull request".
/// </summary>
public class TestMerge : TestMergeBase
{
@@ -9,19 +9,19 @@ namespace Tgstation.Server.Api.Models.Internal
public abstract class TestMergeBase : TestMergeParameters
{
/// <summary>
/// The title of the pull request
/// The title of the test merge source.
/// </summary>
[Required]
public string? TitleAtMerge { get; set; }
/// <summary>
/// The body of the pull request
/// The body of the test merge source.
/// </summary>
[Required]
public string? BodyAtMerge { get; set; }
/// <summary>
/// The URL of the pull request
/// The URL of the test merge source.
/// </summary>
[Required]
#pragma warning disable CA1056 // Uri properties should not be strings
@@ -29,7 +29,7 @@ namespace Tgstation.Server.Api.Models.Internal
#pragma warning restore CA1056 // Uri properties should not be strings
/// <summary>
/// The author of the pull request
/// The author of the test merge source.
/// </summary>
[Required]
public string? Author { get; set; }
@@ -8,7 +8,7 @@ namespace Tgstation.Server.Api.Models
public class TestMergeParameters
{
/// <summary>
/// The number of the pull request
/// The number of the test merge source.
/// </summary>
public int Number { get; set; }
@@ -17,7 +17,7 @@ namespace Tgstation.Server.Api.Models
/// </summary>
[Required]
[StringLength(40)]
public string? TargetCommitSha { get; set; }
public virtual string? TargetCommitSha { get; set; }
/// <summary>
/// Optional comment about the test
@@ -29,7 +29,7 @@ namespace Tgstation.Server.Api.Rights
SetSha = 4,
/// <summary>
/// User may fetch and merge GitHub pull requests.
/// User may create <see cref="Models.TestMerge"/>s.
/// </summary>
MergePullRequest = 8,
@@ -21,7 +21,7 @@ namespace Tgstation.Server.Host.Components.Chat.Commands
public string Name => "prs";
/// <inheritdoc />
public string HelpText => "Display live test merge pull request numbers. Add --repo to view repository test merges";
public string HelpText => "Display live test merge numbers. Add --repo to view test merges in the repository as opposed to live.";
/// <inheritdoc />
public bool AdminOnly => false;
@@ -1,4 +1,4 @@
namespace Tgstation.Server.Host.Components.Events
namespace Tgstation.Server.Host.Components.Events
{
/// <summary>
/// Types of events. Mirror in tgs.dm
@@ -24,10 +24,10 @@
RepoFetch,
/// <summary>
/// Parameters: Pull request number, pull request sha, merger message
/// Parameters: Test merge number, test merge target sha, merger message
/// </summary>
[EventScript("RepoMergePullRequest")]
RepoMergePullRequest,
RepoAddTestMerge,
/// <summary>
/// Parameters: Absolute path to repository root
@@ -1,4 +1,4 @@
using System;
using System;
using System.Globalization;
using Tgstation.Server.Api.Models.Internal;
@@ -14,6 +14,18 @@ namespace Tgstation.Server.Host.Components.Interop.Bridge
/// </summary>
public string TimeMerged { get; set; }
/// <summary>
/// Backing field for <see cref="TargetCommitSha"/> needed to continue to support DMAPI 5.
/// </summary>
public string PullRequestRevision { get; set; }
/// <inheritdoc />
public override string TargetCommitSha
{
get => PullRequestRevision;
set => PullRequestRevision = value;
}
/// <summary>
/// The <see cref="RevisionInformation"/> of the <see cref="TestMergeInformation"/>
/// </summary>
@@ -6,7 +6,7 @@ namespace Tgstation.Server.Host.Components.Repository
interface IGitRemoteFeatures : IGitRemoteAdditionalInformation
{
/// <summary>
/// Gets a formatter string which creates the remote refspec for fetching the HEAD of passed in pull request number.
/// Gets a formatter string which creates the remote refspec for fetching the HEAD of passed in test merge number.
/// </summary>
string TestMergeRefSpecFormatter { get; }
@@ -48,7 +48,7 @@ namespace Tgstation.Server.Host.Components.Repository
Task CheckoutObject(string committish, Action<int> progressReporter, CancellationToken cancellationToken);
/// <summary>
/// Attempt to merge a GitHub pull request into HEAD
/// Attempt to merge the revision specified by a given set of <paramref name="testMergeParameters"/> into HEAD
/// </summary>
/// <param name="testMergeParameters">The <see cref="TestMergeParameters"/> of the pull request</param>
/// <param name="committerName">The name of the merge committer</param>
@@ -275,7 +275,7 @@ namespace Tgstation.Server.Host.Components.Repository
var commitMessage = String.Format(
CultureInfo.InvariantCulture,
"Test merge of pull request #{0}{1}{2}",
"TGS Test merge #{0}{1}{2}",
testMergeParameters.Number,
testMergeParameters.Comment != null
? Environment.NewLine
@@ -390,7 +390,7 @@ namespace Tgstation.Server.Host.Components.Repository
}
await eventConsumer.HandleEvent(
EventType.RepoMergePullRequest,
EventType.RepoAddTestMerge,
new List<string>
{
testMergeParameters.Number.ToString(CultureInfo.InvariantCulture),