From 1d50a0a9f6691b2081e389bafa1f22d2fb6004ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cristi=C3=A1n=20Maureira-Fredes?= Date: Wed, 9 Sep 2020 10:45:05 +0200 Subject: improve create_changelog tool Avoiding the corner case when someone reference another patch on the commit message by the whole 40-digit hash. Remove the 'Fixes' or 'Task-number' from the task ID. Change-Id: I51e93a06a9343b74bc94f7f2c2af1c40024daf9d Reviewed-by: Friedemann Kleint --- tools/create_changelog.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'tools/create_changelog.py') diff --git a/tools/create_changelog.py b/tools/create_changelog.py index 7599cc6b9..8f5ea7ad0 100644 --- a/tools/create_changelog.py +++ b/tools/create_changelog.py @@ -145,7 +145,8 @@ def git_get_sha1s(versions: List[str], pattern: str): command = "git rev-list --reverse --grep '^{}'".format(pattern) command += " {}..{}".format(versions[0], versions[1]) command += " | git cat-file --batch" - command += " | grep -o -E \"^[0-9a-f]{40}\"" + command += " | grep -o -E \"^[0-9a-f]{40} commit\"" + command += " | awk '{print $1}'" print("{}: {}".format(git_command.__name__, command), file=sys.stderr) out_sha1, err = Popen(command, stdout=PIPE, shell=True).communicate() if err: @@ -224,7 +225,9 @@ def create_change_log(versions: List[str]) -> None: def gen_list(d: Dict[str, Dict[str, str]]) -> str: - return "".join(" - [{}] {}\n".format(v["task"], v["title"]) + def clean_task(s): + return s.replace("Fixes: ", "").replace("Task-number: ", "") + return "".join(" - [{}] {}\n".format(clean_task(v["task"]), v["title"]) for _, v in d.items()) -- cgit v1.2.3