コード例 #1
0
        /// <summary>
        /// Конструктор по умолчанию
        /// </summary>
        /// <param name="configurationProvider">Провайдер конфигурации системы</param>
        public ProjectBranchInfoProvider(ConfigurationHolder configuration)
        {
            ProjectLabels = new HashSet <string>(
                configuration.Array("Projects", "Labels")
                .Select(x => x.ToLower()));

            NameSplitters = configuration.CharArray("Projects", "Splitters");
            PadChar       = configuration.Char("Projects", "PadChar");
            PadWidth      = configuration.Int("Projects", "PadWidth");
        }
コード例 #2
0
        /// <summary>
        /// Конктруктор по умолчанию для типа <see cref="BranchInfoProvider"/>
        /// </summary>
        /// <param name="configuration">Конфигурация системы</param>
        /// <param name="mergeRequsts">Клиент запросов на слияние в системе GitLab</param>
        /// <param name="branchInfoProvider">Провайдер информации о конкретной ветви</param>
        public BranchInfoProvider(
            ConfigurationHolder configuration,
            Holder <IMergeRequestClient> mergeRequsts,
            IBranchInfoProvider branchInfoProvider)
        {
            ValueGetter = () =>
            {
                var labels = new HashSet <string>(configuration.Array("GitLab", "PickedLabels"));

                var pickedMergeRequests = mergeRequsts.Value
                                          .AllInState(MergeRequestState.opened)
                                          .Where(x => x.Labels.Any(labels.Contains));

                var branches = pickedMergeRequests
                               .Select(x => branchInfoProvider
                                       .GetBranchInfo(x.SourceBranch)
                                       .SetTag(x.Labels))
                               .OrderBy(x => x.Id);

                return(branches.ToList());
            };
        }