Пример #1
0
        public GitRepository(GitRepositoryProvider repositoryProvider, RepositorySettings settings, RepositoryInfo repositoryInfo)
        {
            this.repositoryProvider = repositoryProvider;
            this.settings           = settings;
            this.logService         = settings.LogService;
            this.repositoryInfo     = repositoryInfo;
            this.resetCommand       = new GitCommand(this.BasePath, "reset")
            {
                new GitCommandItem("hard")
            };
            this.cleanCommand = new GitCommand(this.BasePath, "clean")
            {
                new GitCommandItem('f'),
                new GitCommandItem('d')
            };
            var statusCommand = new GitCommand(this.BasePath, "status")
            {
                new GitCommandItem('s'),
            };
            var items = statusCommand.ReadLines(true);

            if (items.Length != 0)
            {
                var sb = new StringBuilder();
                sb.AppendLine($"Repository is dirty. Please fix the problem before running the service.");
                sb.AppendLine();
                foreach (var item in items)
                {
                    sb.AppendLine(item);
                }
                throw new Exception($"{sb}");
            }
        }
Пример #2
0
 public GitRepositoryMigrator(GitRepositoryProvider repositoryProvider)
 {
     this.repositoryProvider = repositoryProvider;
 }