-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #56 from BertCotton/BC.JobRequests
Fixing JobRequests now properly showing releases.
- Loading branch information
Showing
13 changed files
with
135 additions
and
24 deletions.
There are no files selected for viewing
71 changes: 71 additions & 0 deletions
71
src/TfsAdvanced.DataStore/Comparator/PullRequestComparator.cs
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,71 @@ | ||
using System.Linq; | ||
using TFSAdvanced.Models.ComparisonResults; | ||
using TFSAdvanced.Models.DTO; | ||
|
||
namespace TfsAdvanced.Data.Comparator | ||
{ | ||
public class PullRequestComparator | ||
{ | ||
public static PullRequestComparison Compare(PullRequest original, PullRequest updated) | ||
{ | ||
PullRequestComparison comparison = new PullRequestComparison(); | ||
if (original == null) | ||
{ | ||
comparison.IsNewPullRequest = true; | ||
return comparison; | ||
} | ||
|
||
if (original.buildId != updated.buildId) | ||
{ | ||
comparison.BuildStatusUpdated = true; | ||
comparison.Messages.Add($"Build has changed from {original.buildId} to {updated.buildId}."); | ||
} | ||
|
||
if (original.BuildStatus != updated.BuildStatus) | ||
{ | ||
comparison.BuildStatusUpdated = true; | ||
comparison.Messages.Add($"Build Status has changed from {original.BuildStatus} to {updated.BuildStatus}."); | ||
} | ||
|
||
if (original.LastCommit != updated.LastCommit) | ||
{ | ||
comparison.FilesChanged = true; | ||
comparison.Messages.Add($"Files have been updated from commit {original.LastCommit} to {updated.LastCommit}"); | ||
} | ||
|
||
|
||
if (original.MergeStatus != updated.MergeStatus) | ||
{ | ||
comparison.MergeStatusUpdated = true; | ||
comparison.Messages.Add($"Merge status changed from {original.MergeStatus} to {original.MergeStatus}"); | ||
} | ||
|
||
|
||
foreach (var reviewer in original.Reviewers) | ||
{ | ||
var updatedReviewer = updated.Reviewers.FirstOrDefault(x => x.UniqueName == reviewer.UniqueName); | ||
if (updatedReviewer == null) | ||
{ | ||
comparison.ReviewersUpdated = true; | ||
comparison.Messages.Add($"{reviewer.Name} removed as a reviewer"); | ||
} | ||
else if (reviewer.ReviewStatus != updatedReviewer.ReviewStatus) | ||
{ | ||
comparison.ReviewersUpdated = true; | ||
comparison.Messages.Add($"{reviewer.Name} changed review status from {reviewer.ReviewStatus} to {updatedReviewer.ReviewStatus}"); | ||
} | ||
|
||
} | ||
foreach (var updatedReviewer in updated.Reviewers) | ||
{ | ||
if (original.Reviewers.Any(x => x.UniqueName == updatedReviewer.UniqueName)) | ||
continue; | ||
|
||
comparison.ReviewersUpdated = true; | ||
comparison.Messages.Add($"{updatedReviewer.Name} added as reviewer with status {updatedReviewer.ReviewStatus}"); | ||
} | ||
|
||
return comparison; | ||
} | ||
} | ||
} |
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 |
---|---|---|
@@ -1,24 +1,22 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>netcoreapp1.1</TargetFramework> | ||
<AssemblyName>TFSAdvanced.DataStore</AssemblyName> | ||
<RootNamespace>TFSAdvanced.DataStore</RootNamespace> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="1.1.2" /> | ||
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="1.1.2" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\TfsAdvanced.Models\Models.csproj" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<Reference Include="Microsoft.EntityFrameworkCore"> | ||
<HintPath>C:\Users\bertc\.nuget\packages\microsoft.entityframeworkcore\1.0.3\lib\netstandard1.3\Microsoft.EntityFrameworkCore.dll</HintPath> | ||
</Reference> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<Folder Include="Comparitors" /> | ||
</ItemGroup> | ||
</Project> |
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
19 changes: 19 additions & 0 deletions
19
src/TfsAdvanced.Models/ComparisonResults/PullRequestComparison.cs
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,19 @@ | ||
using System.Collections.Generic; | ||
|
||
namespace TFSAdvanced.Models.ComparisonResults | ||
{ | ||
public class PullRequestComparison | ||
{ | ||
public bool IsNewPullRequest { get; set; } | ||
|
||
public bool ReviewersUpdated { get; set; } | ||
|
||
public bool BuildStatusUpdated { get; set; } | ||
|
||
public bool MergeStatusUpdated { get; set; } | ||
|
||
public bool FilesChanged { get; set; } | ||
|
||
public IList<string> Messages { get; set; } = new List<string>(); | ||
} | ||
} |
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
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