[QGIS Commit] r9188 - trunk/qgis/scripts

svn_qgis at osgeo.org svn_qgis at osgeo.org
Wed Aug 27 07:15:41 EDT 2008


Author: jef
Date: 2008-08-27 07:15:41 -0400 (Wed, 27 Aug 2008)
New Revision: 9188

Added:
   trunk/qgis/scripts/update-indent.sh
Log:
add indentation update script

Added: trunk/qgis/scripts/update-indent.sh
===================================================================
--- trunk/qgis/scripts/update-indent.sh	                        (rev 0)
+++ trunk/qgis/scripts/update-indent.sh	2008-08-27 11:15:41 UTC (rev 9188)
@@ -0,0 +1,61 @@
+#!/bin/bash
+
+if ! [ -x astyle.sh ]; then
+	PATH=$PATH:$(dirname $0)
+fi
+
+set -e
+
+# determine last commit
+REV0=$(svn info | sed -ne "s/Revision: //p")
+
+# update
+MODIFIED=$(svn update | sed -ne "s/^[^ ]* *//p")
+REV1=$(svn info | sed -ne "s/Revision: //p")
+
+if [ "$REV0" -eq "$REV1" ]; then
+	echo "No activity since last run."
+	exit 0
+fi
+
+echo "Checking changes between $REV0 and $REV1"
+
+ASTYLEDIFF=astyle.r$REV0-r$REV1.diff
+>$ASTYLEDIFF
+
+
+# reformat
+for f in $MODIFIED; do
+	case "$f" in
+        *.cpp|*.h|*.c|*.h|*.cxx|*.hxx|*.c++|*.h++|*.cc|*.hh|*.C|*.H)
+                ;;
+
+        *)
+                continue
+                ;;
+        esac
+
+        m=$f.r$REV1.prepare
+
+	cp $f $m
+	astyle.sh $f
+	if diff -u $m $f >>$ASTYLEDIFF; then
+		# no difference found
+		rm $m
+	fi
+done
+
+if [ -s "$ASTYLEDIFF" ]; then
+	if tty -s; then
+		# review astyle changes
+		colordiff <$ASTYLEDIFF | less -r
+	else
+		echo "Files changed (see $ASTYLEDIFF)"
+	fi
+
+	# just echo for now
+	echo svn commit -m "automatic indentation update (r$REV0-r$REV1)"
+else
+	echo "No indentation updates."
+	rm $ASTYLEDIFF
+fi


Property changes on: trunk/qgis/scripts/update-indent.sh
___________________________________________________________________
Name: svn:executable
   + *



More information about the QGIS-commit mailing list