From cae03c6d7e974a1d711021ec0a5d5213ed765294 Mon Sep 17 00:00:00 2001 From: dbr Date: Sun, 20 Jun 2021 22:13:57 +1000 Subject: [PATCH] Initial changelog Also simple process/script to manage entries in PR's without merge conflicts: 1. Unreleased entries area stored as text files in ".changelogs/" 2. On release these are concatenated together and put in CHANGELOG.md Script basically just add line of text to a "YYYY-MM-DD-branch.txt" formatted file --- CHANGELOG.md | 20 ++++++++++++++ scripts/changelog.py | 64 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 84 insertions(+) create mode 100644 CHANGELOG.md create mode 100755 scripts/changelog.py diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 000000000..3f4b0775c --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,20 @@ +# Changelog + +## [Unreleased] + +Note: unreleased change log entries are kept in `.changelogs/` directory in repo root, and can be added with `./script/changelog.py add "Added thing for reason" + +## 0.3.0 - 2021-01-11 +- Flexible named reports +- Updates to the TaskChampion crate API +- Usability improvements + +## 0.2.0 - 2020-11-30 + +This release is the first "MVP" version of this tool. It can do basic task operations, and supports a synchronization. Major missing features are captured in issues, but briefly: + + better command-line API, similar to TaskWarrior + authentication of the replica / server protocol + encryption of replica data before transmission to the server + lots of task features (tags, annotations, dependencies, ..) + lots of CLI features (filtering, modifying, ..) diff --git a/scripts/changelog.py b/scripts/changelog.py new file mode 100755 index 000000000..5775d99c0 --- /dev/null +++ b/scripts/changelog.py @@ -0,0 +1,64 @@ +#!/usr/bin/env python3 +import os +import argparse +import datetime +import subprocess +from typing import List + +def ymd(): + return datetime.datetime.now().strftime("%Y-%m-%d") + +def git_current_branch() -> str : + out = subprocess.check_output(["git", "branch", "--show-current"]) + return out.strip().decode("utf-8") + +def get_dir() -> str: + here = os.path.dirname(os.path.abspath(__file__)) + return os.path.join( + here, + "../.changelogs") + +def get_changefiles() -> List[str]: + changedir = get_dir() + changefiles = [] + for f in os.listdir(changedir): + if f.endswith(".txt") and not f.startswith("."): + changefiles.append(os.path.join(changedir, f)) + + return changefiles + +def cmd_add(args): + text = args.text.strip() + if not text.startswith("- "): + text = "- %s" % text + + timestamp = ymd() + branchname = git_current_branch() + fname = os.path.join(get_dir(), "%s-%s.txt" % (timestamp, branchname)) + with open(fname, "a") as f: + f.write(text) + f.write("\n") + +def cmd_build(args): + print("## x.y.z - %s" % (ymd())) + for e in get_changefiles(): + print(open(e).read().strip()) + +def main() -> None: + parser = argparse.ArgumentParser() + subparsers = parser.add_subparsers(title='Sub commands', dest='command') + subparsers.required = True + + parser_add = subparsers.add_parser('add') + parser_add.add_argument("text") + parser_add.set_defaults(func=cmd_add) + + parser_build = subparsers.add_parser('build') + parser_build.set_defaults(func=cmd_build) + + args = parser.parse_args() + args.func(args) + + +if __name__ == "__main__": + main()