private static CheckInResult CheckIn(IReadOnlyCollection<PendingChange> targetPendingChanges, string comment,
Workspace workspace, IReadOnlyCollection<int> workItemIds, PolicyOverrideInfo policyOverride, WorkItemStore workItemStore)
{
var result = new CheckInResult();
// Another user can update workitem. Need re-read before update.
var workItems = GetWorkItemCheckinInfo(workItemIds, workItemStore);
var evaluateCheckIn = workspace.EvaluateCheckin2(CheckinEvaluationOptions.All,
targetPendingChanges,
comment,
null,
workItems);
var skipPolicyValidate = !policyOverride.PolicyFailures.IsNullOrEmpty();
if (!CanCheckIn(evaluateCheckIn, skipPolicyValidate))
{
result.CheckinResult = MergeResult.CheckInEvaluateFail;
}
var changesetId = workspace.CheckIn(targetPendingChanges.ToArray(), null, comment,
null, workItems, policyOverride);
if (changesetId > 0)
{
result.ChangesetId = changesetId;
result.CheckinResult = MergeResult.CheckIn;
}
else
{
result.CheckinResult = MergeResult.CheckInFail;
}
return result;
}