public void Run(Options options) { string currentDirectory = Directory.GetCurrentDirectory(); Repository repository = new Repository(currentDirectory); Branch currentBranch = repository.Head; if (!string.IsNullOrEmpty(options.Branch)) { Branch selectedBranch = repository.Branches[options.Branch]; if (selectedBranch == null) { _logger.LogError($"Branch {options.Branch} not found"); throw new Exception($"Branch {options.Branch} not found"); } currentBranch = selectedBranch; } Assembly module = Assembly.LoadFile(options.Module); Type moduleType = module.GetTypes().First(t => typeof(ICommitApplier).IsAssignableFrom(t)); ICommitApplier commitApplier = (ICommitApplier)_container.Resolve(moduleType); FilterCrawler filterCrawler = new FilterCrawler(repository, currentBranch, commitApplier); filterCrawler.Crawl(); }
public FilterCrawler(Repository repository, Branch branch, ICommitApplier commitApplier) { _repository = repository; _branch = branch; _commitApplier = commitApplier; }