aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Borkmann <daniel@iogearbox.net>2019-10-16 22:20:41 +0200
committerDaniel Borkmann <daniel@iogearbox.net>2019-10-16 22:20:41 +0200
commit6e3d70047978e020d48ef8850135ae3a3d1122f8 (patch)
treef57043eae9d068d325d718642278f889e3472aa6
parent3e610859cfe0dc5ae1a640db2c4333c8f01d4d65 (diff)
downloadpw-6e3d70047978e020d48ef8850135ae3a3d1122f8.tar.gz
pw: improve pw-pull pull request template message
Example output: --- Subject: pull-request: bpf-next 2019-10-16 Hi David, The following pull-request contains BPF updates for your *net-next* tree. We've added 10 non-merge commits during the last 1 day(s) which contain a total of 23 files changed, 413 insertions(+), 90 deletions(-). The main changes are: 1) ..., from XYZ. Among others: - Blah blah sub item. 2) ..., from ABC. Please consider pulling these changes from: git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git Thanks a lot! Contributors in this PR are: Andrii Nakryiko, Jakub Sitnicki, Jiri Pirko, Song Liu, Stanislav Fomichev Thanks everyone! --- Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
-rwxr-xr-xpw-pull11
1 files changed, 10 insertions, 1 deletions
diff --git a/pw-pull b/pw-pull
index 0b4be4d..a40b926 100755
--- a/pw-pull
+++ b/pw-pull
@@ -15,6 +15,7 @@ remote=""
since=""
tree=""
today=$(date +%Y-%m-%d)
+
while true; do
case "$1" in
-s | --since ) since="$2"; shift 2 ;;
@@ -30,9 +31,17 @@ case $tree in
bpf ) remote=(net git://git.kernel.org/pub/scm/linux/kernel/git/bpf/$tree.git) ;;
* ) usage ;;
esac
+
+old=$(git log $since -n 1 --format=%ct)
+new=$(git log HEAD -n 1 --format=%ct)
+delta=$((($new - $old)/(60*60*24)+1))
+count=$(git rev-list --no-merges --count $since...HEAD)
+what=$(git diff --stat $since...HEAD | tail -n1)
+thanks=$(git log --no-merges $since...HEAD --format="%aN" | sort | uniq | sort -n | sed ':a;N;$!ba;s/\n/, /g' | fold -s -w73)
+
file="pr-$tree-$today.patch"
git request-pull $since ${remote[1]} > $file
-echo -e "Subject: pull-request: $tree $today\n\nHi David,\n\nThe following pull-request contains BPF updates for your *${remote[0]}* tree.\n\nThe main changes are:\n\n1) ..., from XYZ. Among others:\n\n - Blah blah sub item.\n\n2) ..., from ABC.\n\nPlease consider pulling these changes from:\n\n git://git.kernel.org/pub/scm/linux/kernel/git/bpf/$tree.git\n\nThanks a lot!\n\n----------------------------------------------------------------\n\n$(cat $file)" > $file
+echo -e "Subject: pull-request: $tree $today\n\nHi David,\n\nThe following pull-request contains BPF updates for your *${remote[0]}* tree.\n\nWe've added $count non-merge commits during the last $delta day(s) which contain\na total of$what.\n\nThe main changes are:\n\n1) ..., from XYZ. Among others:\n\n - Blah blah sub item.\n\n2) ..., from ABC.\n\nPlease consider pulling these changes from:\n\n git://git.kernel.org/pub/scm/linux/kernel/git/bpf/$tree.git\n\nThanks a lot!\n\nContributors in this PR are:\n\n$thanks\n\nThanks everyone!\n\n----------------------------------------------------------------\n\n$(cat $file)" > $file
bug=$(grep -c gitolite $file)
if [ "$bug" -gt "0" ]; then
echo "PR not generated: using gitolite url, not public one!"