public static string GetDisplayBranchName(List<string> branches, BranchNameMatch[] aliases) { if (branches == null || branches.Count == 0) return string.Empty; if (branches.Count == 1) { return GetShortBranchName(branches[0], aliases); } return "multi"; }
public static string GetShortBranchName(string branchFullName, BranchNameMatch[] aliases) { foreach (var branchNameMatch in (aliases ?? new BranchNameMatch[0]) .Concat(new[] { new BranchNameMatch { match = "/([^/]+)$", alias = "$1" } })) // default match { var regex = new Regex(branchNameMatch.match); var match = regex.Match(branchFullName); if (match.Success) { return match.Result(branchNameMatch.alias); //return first match } } return branchFullName; // return full name if nothing matched }
public CommentFormater(CommentFormat format, BranchNameMatch[] aliases) { _format = format; _aliases = aliases; }
public MergeInfoViewModel(IEventAggregator eventAggregator, BranchNameMatch[] aliases) { _eventAggregator = eventAggregator; _aliases = aliases; }