From e43e48687091670ce61c8a302adc75f7c25bc2ee Mon Sep 17 00:00:00 2001 From: Christian Neukirchen Date: Thu, 9 Jul 2015 13:39:23 +0200 Subject: xrevbump: add - and detect already bumped pkgs. --- xrevbump | 37 +++++++++++++++++++++++++++++++------ 1 file changed, 31 insertions(+), 6 deletions(-) diff --git a/xrevbump b/xrevbump index 29b8f8b..a46c2cf 100755 --- a/xrevbump +++ b/xrevbump @@ -1,6 +1,8 @@ #!/bin/bash # xrevbump MESSAGE TEMPLATES... - increase template revision and commit +# TEMPLATES can be "-", then read linewise from stdin. + MESSAGE=$1 shift @@ -9,7 +11,12 @@ if [ $# -eq 0 ]; then exit 1 fi -for t; do +seen=' ' +nl=' +' + +bump() { + t="$1" if [ -f "$t" ]; then : elif [ -f "$t/template" ]; then @@ -23,9 +30,27 @@ for t; do . "$t" - revision=$((revision + 1)) - printf "%s: bump to revision %d\n" "$t" "$revision" + case "$seen" in + *" $pkgname "*) + printf "%s: bumped already.\n" "$t" + ;; + *) + revision=$((revision + 1)) + printf "%s: bump to revision %d\n" "$t" "$revision" - sed -i -e "/^revision=/s/=.*/=$revision/" "$t" - git -C "${t%/*}" commit -m "$pkgname: $MESSAGE" template -done + sed -i -e "/^revision=/s/=.*/=$revision/" "$t" + git -C "${t%/*}" commit -m "$pkgname: $MESSAGE" template + seen="$seen $pkgname " + ;; + esac +} + +if [ "$1" = - ]; then + while IFS="$nl" read -r t; do + bump "$t" + done +else + for t; do + bump "$t" + done +fi -- cgit 1.4.1