public static async Task <List <GitLogEntry> > GetGitLogEntries(this ProcessManager processManager, NPath workingDirectory, IEnvironment environment, IFileSystem filesystem, IProcessEnvironment gitEnvironment, int?logCount = null, NPath?gitPath = null) { var gitStatusEntryFactory = new GitObjectFactory(environment); var processor = new LogEntryOutputProcessor(gitStatusEntryFactory); var logNameStatus = @"log --pretty=format:""%H%n%P%n%aN%n%aE%n%aI%n%cN%n%cE%n%cI%n%B---GHUBODYEND---"" --name-status"; if (logCount.HasValue) { logNameStatus = logNameStatus + " -" + logCount.Value; } NPath path = gitPath ?? defaultGitPath; var results = await new ProcessTaskWithListOutput <GitLogEntry>(CancellationToken.None, processor) .Configure(processManager, path, logNameStatus, workingDirectory, false) .Start() .Task; return(results); }
public static ITask <List <GitLogEntry> > GetGitLogEntries(this IProcessManager processManager, NPath workingDirectory, IEnvironment environment, int logCount = 0, NPath?gitPath = null) { var gitStatusEntryFactory = new GitObjectFactory(environment); var processor = new LogEntryOutputProcessor(gitStatusEntryFactory); return(new GitLogTask(logCount, null, CancellationToken.None, processor) .Configure(processManager, gitPath ?? defaultGitPath, workingDirectory: workingDirectory)); }
private void AssertProcessOutput(IEnumerable <string> lines, GitLogEntry[] expected) { var gitObjectFactory = SubstituteFactory.CreateGitObjectFactory(TestRootPath); var results = new List <GitLogEntry>(); var outputProcessor = new LogEntryOutputProcessor(gitObjectFactory); outputProcessor.OnEntry += logEntry => { results.Add(logEntry); }; foreach (var line in lines) { outputProcessor.LineReceived(line); } results.AssertEqual(expected); }