Author: jannis
Date: 2007-02-12 22:18:26 +0000 (Mon, 12 Feb 2007)
New Revision: 24965

Added:
   xfce4-dev-tools/trunk/scripts/xdt-commit
Modified:
   xfce4-dev-tools/trunk/ChangeLog
   xfce4-dev-tools/trunk/scripts/Makefile.am
Log:
        * scripts/Makefile.am, scripts/xdt-commit: Add script for 
          generating commit messages from ChangeLogs on the fly.

Modified: xfce4-dev-tools/trunk/ChangeLog
===================================================================
--- xfce4-dev-tools/trunk/ChangeLog     2007-02-12 20:25:12 UTC (rev 24964)
+++ xfce4-dev-tools/trunk/ChangeLog     2007-02-12 22:18:26 UTC (rev 24965)
@@ -1,3 +1,8 @@
+2007-02-12     Jannis Pohlmann <[EMAIL PROTECTED]>
+
+       * scripts/Makefile.am, scripts/xdt-commit: Add script for 
+         generating commit messages from ChangeLogs on the fly.
+
 2007-01-20     Benedikt Meurer <[EMAIL PROTECTED]>
 
        * configure.in.in: Post-release version bump.

Modified: xfce4-dev-tools/trunk/scripts/Makefile.am
===================================================================
--- xfce4-dev-tools/trunk/scripts/Makefile.am   2007-02-12 20:25:12 UTC (rev 
24964)
+++ xfce4-dev-tools/trunk/scripts/Makefile.am   2007-02-12 22:18:26 UTC (rev 
24965)
@@ -7,7 +7,8 @@
 #
 
 bin_SCRIPTS =                                                          \
-       xdt-autogen
+       xdt-autogen                                                     \
+       xdt-commit                                                      
 
 xdt-autogen: Makefile $(srcdir)/xdt-autogen.in
        rm -f xdt-autogen xdt-autogen.gen

Added: xfce4-dev-tools/trunk/scripts/xdt-commit
===================================================================
--- xfce4-dev-tools/trunk/scripts/xdt-commit                            (rev 0)
+++ xfce4-dev-tools/trunk/scripts/xdt-commit    2007-02-12 22:18:26 UTC (rev 
24965)
@@ -0,0 +1,93 @@
+#!/bin/sh
+#
+# $Id$
+#
+# Copyright (c) 2007 
+#         The Xfce development team. All rights reserved.
+#
+# Written for Xfce by Jannis Pohlmann <[EMAIL PROTECTED]>.
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the Free
+# Software Foundation; either version 2 of the License, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+# more details.
+#
+# You should have received a copy of the GNU General Public License along with
+# this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+# Place, Suite 330, Boston, MA  02111-1307  USA
+#
+# xdt-commit - Part of the Xfce developer tools.
+#
+
+
+##
+## Check if SVN is installed
+##
+if ! svn --version &> /dev/null; then
+  echo "Subversion needs to be installed."
+  exit 1
+fi
+
+
+##
+## Check if we are in a versioned directory 
+##
+if ! svn info &> /dev/null; then
+  echo "Current working directory is not versioned."
+  exit 1
+fi
+
+
+##
+## Files to be committed
+##
+FILES="$*"
+
+
+##
+## Detect all ChangeLog's inside this directory by scanning it 
+## recursively
+##
+CHANGELOGS=$(find . -type f -iname ChangeLog)
+
+
+##
+## Append parsed diff output of each ChangeLog to the commit message
+##
+for CHANGELOG in $CHANGELOGS; do
+  # Make sure the file exists
+  if [ -f "$CHANGELOG" ]; then
+    # Determine SVN status 
+    STATUS=$(svn status ${CHANGELOG})
+    STATUS=${STATUS:0:1}
+
+    # Check if file is versioned
+    if [ "$STATUS" != "?" ]; then
+      # Parse output
+      MSG=$(svn diff ${CHANGELOG} | grep -P '^\+\t' | sed 's/^+//')
+
+      # Append to commit message (and insert newline between ChangeLogs)
+      if [ -z "$COMMIT_MSG" ]; then
+        COMMIT_MSG="$MSG"
+      else
+        COMMIT_MSG=$(echo "$COMMIT_MSG" $'\n' "$MSG")
+      fi
+    fi
+  fi
+done
+
+
+##
+## Commit changes. If the commit message generate from the ChangeLog 
+## files is empty, ask the user to enter a commit message himself
+##
+if [ -n "$COMMIT_MSG" ]; then
+  svn commit $FILES -m "$COMMIT_MSG"
+else
+  svn commit $FILES
+fi


Property changes on: xfce4-dev-tools/trunk/scripts/xdt-commit
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:keywords
   + Id Author Date Revision

_______________________________________________
Xfce4-commits mailing list
[email protected]
http://foo-projects.org/mailman/listinfo/xfce4-commits

Reply via email to