[Pkg-haskell-commits] darcs: tools: Add a script to apply a change to all packages

Joachim Breitner mail at joachim-breitner.de
Sat Oct 13 12:11:27 UTC 2012


Sat Oct 13 12:11:09 UTC 2012  Joachim Breitner <mail at joachim-breitner.de>
  * Add a script to apply a change to all packages
  Ignore-this: e9b361711b882c6432e89bdad894dece

    A ./mass-change.sh

Sat Oct 13 12:11:09 UTC 2012  Joachim Breitner <mail at joachim-breitner.de>
  * Add a script to apply a change to all packages
  Ignore-this: e9b361711b882c6432e89bdad894dece
diff -rN -u old-tools//mass-change.sh new-tools//mass-change.sh
--- old-tools//mass-change.sh	1970-01-01 00:00:00.000000000 +0000
+++ new-tools//mass-change.sh	2012-10-13 12:11:27.503723321 +0000
@@ -0,0 +1,51 @@
+#!/bin/bash
+
+message=$1
+shift
+action=$1
+shift
+
+if [ -z "$message" -o -z "$action" -o "$message" = '--help' ]
+then
+	echo "Usage: $0 <message> '<action>' dirs..."
+	echo
+	echo "Runs <action> in each given directory; commits with <message> if"
+	echo "<action> had an effect. Pulls before. Does not push, so you can"
+	echo "fix your mess afterwards."
+	exit
+fi
+
+while [ -n "$1" ]
+do
+	dir=$1
+	shift
+
+	if ! pushd "$dir"
+	then
+		echo "Failed to switch to \"$dir\""
+		continue
+	fi
+
+	if [ ! -e changelog ]
+	then
+		echo "No changelog file found, skipping $dir"
+		popd
+		continue
+	fi
+	
+	echo "Processing $dir"
+	darcs pull -a -v
+	eval "$action"
+
+	if ! darcs whatsnew -s
+	then
+		echo "Action did not change $dir, skipping push"
+		popd
+		continue
+	fi
+	echo "About to commit the following change:"
+	darcs diff|colordiff
+	debchange --changelog=changelog "$message"
+	debcommit
+	popd
+done





More information about the Pkg-haskell-commits mailing list