public static string GetCheckInComment(CheckInComment checkInCommentChoice, string commentFormat, string sourceBranch, string targetBranch, IEnumerable <int> workItemIds, IEnumerable <int> changesetIds, bool isLatestVersion) { var comment = string.Empty; try { if (checkInCommentChoice == CheckInComment.MergeDirection) { comment = string.Format(CultureInfo.CurrentCulture, commentFormat, sourceBranch.GetBranchName(), targetBranch.GetBranchName()); } else if (checkInCommentChoice == CheckInComment.WorkItemIds) { comment = string.Format(CultureInfo.CurrentCulture, commentFormat, GetIdsSplitedOrShowLatestVersionComment(workItemIds, isLatestVersion)); } else if (checkInCommentChoice == CheckInComment.Fixed) { comment = commentFormat; } else if (checkInCommentChoice == CheckInComment.MergeDirectionAndWorkItems) { comment = string.Format(CultureInfo.CurrentCulture, commentFormat, sourceBranch.GetBranchName(), targetBranch.GetBranchName(), GetIdsSplitedOrShowLatestVersionComment(workItemIds, isLatestVersion)); } else if (checkInCommentChoice == CheckInComment.ChangesetIds) { comment = string.Format(CultureInfo.CurrentCulture, commentFormat, GetIdsSplitedOrShowLatestVersionComment(changesetIds, isLatestVersion)); } else if (checkInCommentChoice == CheckInComment.MergeDirectionAndChangesetIds) { comment = string.Format(CultureInfo.CurrentCulture, commentFormat, sourceBranch.GetBranchName(), targetBranch.GetBranchName(), GetIdsSplitedOrShowLatestVersionComment(changesetIds, isLatestVersion)); } } catch (FormatException) { comment = Resources.InvalidFormat; } return(comment); }
public static string GetCheckInComment(CheckInComment checkInCommentChoice, string commentFormat, string commentLineFormat, string sourceBranch, string targetBranch, IEnumerable <int> workItemIds, IEnumerable <Changeset> changesets, bool isLatestVersion) { var comment = string.Empty; try { if (checkInCommentChoice == CheckInComment.MergeDirection) { comment = string.Format(CultureInfo.CurrentCulture, commentFormat, sourceBranch.GetBranchName(), targetBranch.GetBranchName()); } else if (checkInCommentChoice == CheckInComment.WorkItemIds) { comment = string.Format(CultureInfo.CurrentCulture, commentFormat, GetIdsSplitedOrShowLatestVersionComment(workItemIds, isLatestVersion)); } else if (checkInCommentChoice == CheckInComment.Fixed) { comment = commentFormat; } else if (checkInCommentChoice == CheckInComment.MergeDirectionAndWorkItems) { comment = string.Format(CultureInfo.CurrentCulture, commentFormat, sourceBranch.GetBranchName(), targetBranch.GetBranchName(), GetIdsSplitedOrShowLatestVersionComment(workItemIds, isLatestVersion)); } else if (checkInCommentChoice == CheckInComment.ChangesetIds) { comment = string.Format(CultureInfo.CurrentCulture, commentFormat, GetIdsSplitedOrShowLatestVersionComment(changesets.Select(x => x.ChangesetId), isLatestVersion)); } else if (checkInCommentChoice == CheckInComment.MergeDirectionAndChangesetIds) { comment = string.Format(CultureInfo.CurrentCulture, commentFormat, sourceBranch.GetBranchName(), targetBranch.GetBranchName(), GetIdsSplitedOrShowLatestVersionComment(changesets.Select(x => x.ChangesetId), isLatestVersion)); } else if (checkInCommentChoice == CheckInComment.ChangesetsDetails) { if (!isLatestVersion) { comment = CreateLineChangesetDetailComment(commentFormat, changesets); } else { comment = Resources.LatestVersion; } } else if (checkInCommentChoice == CheckInComment.MergeDirectionChangesetsDetails) { comment = string.Format(CultureInfo.CurrentCulture, commentFormat, sourceBranch.GetBranchName(), targetBranch.GetBranchName()); if (!isLatestVersion) { if (changesets.Any()) { comment += Environment.NewLine; comment += CreateLineChangesetDetailComment(commentLineFormat ?? string.Empty, changesets); } } else { comment += Resources.LatestVersion; } } } catch (FormatException) { comment = Resources.InvalidFormat; } return(comment); }