public ManagementController(IRepositoryMediator repository, IRemoteRepositoryState repositoryState, IBranchSettings branchSettings, IUnitOfWorkFactory unitOfWorkFactory)
 {
     this.repository        = repository;
     this.repositoryState   = repositoryState;
     this.branchSettings    = branchSettings;
     this.unitOfWorkFactory = unitOfWorkFactory;
 }
Example #2
0
        public FakeCacheHelper(IRepositoryMediator <T> repoMediator)
        {
            _repoMediator = repoMediator;
            _cache        = new Dictionary <int, T>();

            InitializeListeners();
        }
Example #3
0
 public Internal(IGitCli cli, IBranchSettings settings, IRepositoryMediator repository, IUnitOfWorkFactory unitOfWorkFactory, string deletingBranch, DeleteBranchMode mode)
 {
     this.cli               = cli;
     this.settings          = settings;
     this.repository        = repository;
     this.unitOfWorkFactory = unitOfWorkFactory;
     this.deletingBranch    = deletingBranch;
     this.mode              = mode;
 }
 public ConsolidateMergedActionProcess(IGitCli cli, IRepositoryMediator repository, IBranchSettings branchSettings, IRepositoryOrchestration orchestration, IUnitOfWorkFactory workFactory, string sourceBranch, string newBaseBranch)
 {
     this.cli            = cli;
     this.repository     = repository;
     this.branchSettings = branchSettings;
     this.orchestration  = orchestration;
     this.workFactory    = workFactory;
     this.sourceBranch   = sourceBranch;
     this.newBaseBranch  = newBaseBranch;
 }
Example #5
0
 public IntegrateBranchesOrchestration(IGitServiceApi gitServiceApi, IUnitOfWorkFactory workFactory, IRepositoryOrchestration orchestration, IIntegrationNamingMediator integrationNaming, IBranchSettings settings, IRepositoryMediator repository, IBranchIterationMediator branchIteration)
 {
     this.gitServiceApi     = gitServiceApi;
     this.workFactory       = workFactory;
     this.orchestration     = orchestration;
     this.integrationNaming = integrationNaming;
     this.settings          = settings;
     this.repository        = repository;
     this.branchIteration   = branchIteration;
 }
        private void PushRef(JObject contents, IRepositoryMediator repository)
        {
            var refName    = contents["ref"].ToString();
            var branchName = refName.StartsWith(refPrefix) ? refName.Substring(refPrefix.Length) : refName;

            if (branchName == null)
            {
                return;
            }
            repository.CheckForUpdatesOnBranch(branchName);
        }
 public Internal(IGitCli cli, IRepositoryMediator repository, IBranchSettings settings, IBranchIterationMediator branchIteration, IUnitOfWorkFactory unitOfWorkFactory, IRepositoryOrchestration orchestration, IOptions <GitRepositoryOptions> options, string releaseCandidateBranch, string serviceLineBranch, string tagName, bool autoConsolidate)
 {
     this.cli                    = cli;
     this.repository             = repository;
     this.settings               = settings;
     this.branchIteration        = branchIteration;
     this.unitOfWorkFactory      = unitOfWorkFactory;
     this.orchestration          = orchestration;
     this.isReadOnly             = options.Value.ReadOnly;
     this.releaseCandidateBranch = releaseCandidateBranch;
     this.serviceLineBranch      = serviceLineBranch;
     this.tagName                = tagName;
     this.autoConsolidate        = autoConsolidate;
 }
Example #8
0
 public MergeDownstreamActionProcess(IGitCli cli, IGitServiceApi gitServiceApi, IUnitOfWorkFactory workFactory, IRepositoryOrchestration orchestration, IRepositoryMediator repository, IntegrateBranchesOrchestration integrateBranches, IBranchIterationMediator branchIteration, string downstreamBranch, IOptions <GitRepositoryOptions> options, IMergeStrategyManager strategyManager)
 {
     this.cli                   = cli;
     this.gitServiceApi         = gitServiceApi;
     this.integrateBranches     = integrateBranches;
     this.repository            = repository;
     this.orchestration         = orchestration;
     this.branchIteration       = branchIteration;
     this.downstreamBranchGroup = downstreamBranch;
     this.detailsTask           = repository.GetBranchDetails(downstreamBranch).FirstAsync().ToTask();
     this.latestBranchName      = detailsTask.ContinueWith(task => repository.LatestBranchName(task.Result).FirstOrDefaultAsync().ToTask()).Unwrap();
     this.strategyTask          = detailsTask.ContinueWith(task => strategyManager.GetMergeStrategy(task.Result));
     this.isReadOnly            = options.Value.ReadOnly;
     this.workFactory           = workFactory;
 }
Example #9
0
        /// <summary>
        /// 构造注入
        /// </summary>
        /// <param name="_options"></param>
        /// <param name="_service"></param>
        public BaseRepository(IServiceProvider _service, RepositoryOptions <TDbContext> _unitOfWorkOptions, IDbContextFactory _repositoryFactory, IRepositoryMediator <TDbContext> _repositoryMediator, IEFOptionsFactory eFOptionsFactory)
        {
            unitOfWorkOptions = _unitOfWorkOptions;
            //获取上下文类型
            unitOfWorkOptions.DbContextType = typeof(TDbContext);
            //获取ef的配置信息
            var dbInfo = eFOptionsFactory.Get <TDbContext>();

            unitOfWorkOptions.WriteReadConnectionString = dbInfo?.WriteReadConnectionString;
            //是否开启读写分离操作
            unitOfWorkOptions.IsOpenMasterSlave = dbInfo.IsOpenMasterSlave;
            //获取上下文
            var _dbContext = _service.GetService(unitOfWorkOptions.DbContextType) as DbContext;

            //设置上下文工厂
            _repositoryFactory.Set(unitOfWorkOptions?.DbContextType, _dbContext);

            repositoryMediator = _repositoryMediator;
        }
 public Repository(IRepositoryMediator <T> mediator, IList <T> list)
 {
     _mediator = mediator;
     _entities = list;
 }
 public NormalMergeStrategy(IRepositoryMediator repository)
 {
     this.repository = repository;
 }
Example #12
0
 public void Post([FromServices] IRepositoryMediator repository)
 {
     repository.CheckForUpdates();
 }
Example #13
0
 private Task <BadBranchInfo> GetBadBranchInfo([Source] GitRef gitRef, [FromServices] IRepositoryMediator repository)
 {
     return(repository.GetBadBranchInfo(gitRef.Name));
 }
        public async Task ClearBadBranchStatus(string branchName, [FromServices] IOrchestrationActions orchestrationActions, [FromServices] IRepositoryMediator repository)
        {
            await repository.ResetBadBranchStatus(branchName);

#pragma warning disable CS4014
            orchestrationActions.CheckDownstreamMerges(branchName);
#pragma warning restore CS4014
        }
            private async Task <bool> CreateOrFastForwardServiceLine(string latestBranchName, IRepositoryMediator repository, IGitCli cli)
            {
                var showRefResult = await repository.GetBranchRef(serviceLineBranch).Take(1);

                if (showRefResult == null)
                {
                    // create service line
                    await AppendProcess(cli.CheckoutRemote(latestBranchName)).WaitUntilComplete();

                    await AppendProcess(cli.CheckoutNew(serviceLineBranch)).WaitUntilComplete();

                    return(true);
                }
                else
                {
                    // fast-forward
                    await AppendProcess(cli.CheckoutRemote(serviceLineBranch)).WaitUntilComplete();

                    var fastForward = cli.MergeFastForward(latestBranchName);
                    await AppendProcess(fastForward).WaitUntilComplete();

                    var fastForwardResult = fastForward.ExitCode;

                    return(fastForwardResult == 0);
                }
            }
Example #16
0
 public static async Task <bool> IsBadBranch(this IRepositoryMediator repository, string branchName)
 {
     return((await repository.GetBadBranchInfo(branchName)) != null);
 }
 public ForceFreshMergeStrategy(MergeNextIterationMergeStrategy mergeNextIteration, IRepositoryMediator repository, IGitCli cli)
 {
     this.mergeNextIteration = mergeNextIteration;
     this.repository         = repository;
     this.cli = cli;
 }
Example #18
0
 private Task <bool> IsBad([Source] GitRef gitRef, [FromServices] IRepositoryMediator repository)
 {
     return(repository.IsBadBranch(gitRef.Name));
 }