about summary refs log tree commit diff
path: root/xrevbump
diff options
context:
space:
mode:
authorChristian Neukirchen <chneukirchen@gmail.com>2015-07-09 13:39:23 +0200
committerChristian Neukirchen <chneukirchen@gmail.com>2015-07-09 13:39:23 +0200
commite43e48687091670ce61c8a302adc75f7c25bc2ee (patch)
tree0a86be844a1f8de00da256a9eed5684a7a6dbf9e /xrevbump
parentc683ab785d3b040981420b71432c1569195ff822 (diff)
downloadxtools-e43e48687091670ce61c8a302adc75f7c25bc2ee.tar.gz
xtools-e43e48687091670ce61c8a302adc75f7c25bc2ee.tar.xz
xtools-e43e48687091670ce61c8a302adc75f7c25bc2ee.zip
xrevbump: add - and detect already bumped pkgs.
Diffstat (limited to 'xrevbump')
-rwxr-xr-xxrevbump37
1 files 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