private void GetChangelogCommits(string tag, ChangelogOptions options) { string from = (!String.IsNullOrEmpty(tag)) ? tag : options.From; var git = new Git(options.WorkingDirectory); var commits = git.GetCommits(from: from, to: options.To ?? "HEAD"); WriteLog(commits, options); }
private void WriteLog(List <CommitMessage> commits, ChangelogOptions options) { Writer writer = new Writer(); string changelog = writer.WriteLog(commits, new WriterOptions() { Version = options.Version }); string filePath = fileSystem.Path.Combine(options.WorkingDirectory, options.File); string currentlog = ""; if (fileSystem.File.Exists(filePath)) { currentlog = fileSystem.File.ReadAllText(filePath, Encoding.UTF8); } fileSystem.File.WriteAllText(filePath, changelog + "\n" + currentlog, Encoding.UTF8); }
public void Generate(ChangelogOptions options) { if (String.IsNullOrEmpty(options.Version)) { throw new Exception("No version specified"); } var git = new Git(options.WorkingDirectory); // Get the latest tag or commit string tag; try { tag = git.LatestTag(); } catch (GitException ex) { throw new GitException("Failed to read git tags: " + ex.Message, ex); } GetChangelogCommits(tag, options); }