Skip to content
This repository has been archived by the owner on Apr 6, 2024. It is now read-only.

Commit

Permalink
Merge branch 'hotfix/0.4.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
pascalberger committed Aug 14, 2018
2 parents c859aee + 7281554 commit bab86b6
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
2 changes: 1 addition & 1 deletion nuspec/nuget/Cake.Issues.PullRequests.Tfs.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ See the Project Site for an overview of the whole ecosystem of addins for workin
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<copyright>Copyright © BBT Software AG and contributors</copyright>
<tags>Cake Script Cake-Issues Cake-PullRequestSystem Issues PullRequest TFS VSTS</tags>
<releaseNotes>https://github.com/cake-contrib/Cake.Issues.PullRequests.Tfs/releases/tag/0.4.0</releaseNotes>
<releaseNotes>https://github.com/cake-contrib/Cake.Issues.PullRequests.Tfs/releases/tag/0.4.1</releaseNotes>
</metadata>
<files>
<file src="Cake.Issues.PullRequests.Tfs.dll" target="lib\net461" />
Expand Down
22 changes: 20 additions & 2 deletions src/Cake.Issues.PullRequests.Tfs/TfsPullRequestSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
{
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Threading;
using Core.Diagnostics;
Expand Down Expand Up @@ -568,14 +569,31 @@ private int TryGetCodeFlowChangeTrackingId(GitPullRequestIterationChanges change
path.NotNull(nameof(path));

var change = changes.ChangeEntries.Where(x => x.Item.Path == "/" + path.ToString()).ToList();
if (change.Count != 1)

if (change.Count == 0)
{
this.Log.Error(
"Cannot post a comment for the file {0} because no changes could be found.",
"Cannot post a comment for the file {0} because no changes on the pull request server could be found.",
path);
return -1;
}

if (change.Count > 1)
{
this.Log.Error(
"Cannot post a comment for the file {0} because more than one change has been found on the pull request server:" + Environment.NewLine + "{1}",
path,
string.Join(
Environment.NewLine,
change.Select(
x => string.Format(
CultureInfo.InvariantCulture,
" ID: {0}, Path: {1}",
x.ChangeId,
x.Item.Path))));
return -1;
}

var changeTrackingId = change.Single().ChangeTrackingId;
this.Log.Verbose(
"Determined ChangeTrackingId of {0} for {1}",
Expand Down

0 comments on commit bab86b6

Please sign in to comment.