From bf851af24f1ebc2f7c5e5a0e4897dda207f8adf4 Mon Sep 17 00:00:00 2001 From: Vincent Petry Date: Mon, 14 Aug 2017 11:05:38 +0200 Subject: [PATCH 1/2] Add entries generator script --- build/gen_changelog.sh | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100755 build/gen_changelog.sh diff --git a/build/gen_changelog.sh b/build/gen_changelog.sh new file mode 100755 index 000000000000..0518ddf7f094 --- /dev/null +++ b/build/gen_changelog.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +COMMIT_RANGE="$1" + +BASE_URL="https://github.com/owncloud/core/issues/" + +if test -z "$1"; then + echo "This script builds changelog entries based on merge commits within the given range" >&2 + echo "" >&2 + echo "Usage $0 commit_range" >&2 + echo "" >&2 + echo "commit_range is \"commitid1..commitid2\", for example \"v10.0.2..stable20\"" >&2 + exit 1 +fi + +# get all merge commits within the commit range +git log --merges "$COMMIT_RANGE" --format="format:%s - %b" | + # only pick the "pull request" ones in case of some bad merges + grep "pull request" | + # pick up PR id and subject + cut -d" " -f4,8- | + # move the PR id to the end of the row + sed -e "s&^\(#[0-9]*\) \(.*\)$&- \2 - \1&g" | + # replace PR id with Github links + sed -e "s& #\([0-9]*\)$& \[#\1\]\("$BASE_URL"\1\)&g" | + # remove "[stable10]" or other prefix strings + sed -e "s&\[stable[0-9]*\] &&gi" + + From 34bc388d04aeba82fad8dec6ffade6d1daba021e Mon Sep 17 00:00:00 2001 From: Vincent Petry Date: Mon, 14 Aug 2017 11:22:31 +0200 Subject: [PATCH 2/2] Make changelog script independent of repo Makes it possible to run it for other repositories --- build/gen_changelog.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build/gen_changelog.sh b/build/gen_changelog.sh index 0518ddf7f094..6750469399f4 100755 --- a/build/gen_changelog.sh +++ b/build/gen_changelog.sh @@ -2,7 +2,8 @@ COMMIT_RANGE="$1" -BASE_URL="https://github.com/owncloud/core/issues/" +REPO=`git remote -v | grep -m 1 "(push)" | sed -e "s/.*github.com[:/]\(.*\)\.git.*/\1/"` +BASE_URL="https://github.com/$REPO/issues/" if test -z "$1"; then echo "This script builds changelog entries based on merge commits within the given range" >&2