[Phpmyadmin-git] [SCM] phpMyAdmin scripts branch, master, updated. e6796538aab188515753c63e544157177651e823
Michal Čihař
nijel at users.sourceforge.net
Thu Feb 25 17:15:19 CET 2010
The branch, master has been updated
via e6796538aab188515753c63e544157177651e823 (commit)
via 3272c3d9c0336660f7a922f40e03f51e58894472 (commit)
via 7b2513d0877cb02d17fba7a3782fd9b8104d52e8 (commit)
via ed4f19cbcc44d2bd5607d1639e1b90c902c229bb (commit)
via 12cb553fc77138f3405d6c0befb7df9a8eab0e91 (commit)
from 02593571f4d0448d24024d62c73cb022f36c2078 (commit)
- Log -----------------------------------------------------------------
commit e6796538aab188515753c63e544157177651e823
Author: Michal Čihař <michal at cihar.com>
Date: Thu Feb 25 17:14:41 2010 +0100
Fix viewer url.
commit 3272c3d9c0336660f7a922f40e03f51e58894472
Author: Michal Čihař <michal at cihar.com>
Date: Thu Feb 25 17:13:43 2010 +0100
Adjust config.
commit 7b2513d0877cb02d17fba7a3782fd9b8104d52e8
Author: Michal Čihař <michal at cihar.com>
Date: Thu Feb 25 17:13:33 2010 +0100
Call new bot.
commit ed4f19cbcc44d2bd5607d1639e1b90c902c229bb
Author: Michal Čihař <michal at cihar.com>
Date: Thu Feb 25 17:12:05 2010 +0100
Add another ciabot.
This one seems to better fit our needs.
commit 12cb553fc77138f3405d6c0befb7df9a8eab0e91
Author: Michal Čihař <michal at cihar.com>
Date: Thu Feb 25 17:08:05 2010 +0100
CIA notification per commit.
-----------------------------------------------------------------------
Summary of changes:
git-hooks/git-ciabot | 109 ++++++++++++++++++++++++++++++++++++++++++++++++
git-hooks/post-receive | 4 +-
2 files changed, 112 insertions(+), 1 deletions(-)
create mode 100755 git-hooks/git-ciabot
diff --git a/git-hooks/git-ciabot b/git-hooks/git-ciabot
new file mode 100755
index 0000000..1fb1b37
--- /dev/null
+++ b/git-hooks/git-ciabot
@@ -0,0 +1,109 @@
+#!/usr/bin/env bash
+# Distributed under the terms of the GNU General Public License v2
+# Copyright (c) 2006 Fernando J. Pereda <ferdy at gentoo.org>
+#
+# Git CIA bot in bash. (no, not the POSIX shell, bash).
+# It is *heavily* based on Git ciabot.pl by Petr Baudis.
+#
+# It is meant to be run either on a post-commit hook or in an update
+# hook:
+#
+# post-commit: It parses latest commit and current HEAD to get the
+# information it needs.
+#
+# update: You have to call it once per merged commit:
+#
+# refname=$1
+# oldhead=$2
+# newhead=$3
+# for merged in $(git rev-list ${oldhead}..${newhead} | tac) ; do
+# /path/to/ciabot.bash ${refname} ${merged}
+# done
+#
+
+# The project as known to CIA
+project="$(git repo-config hooks.cia-project)"
+
+# Set to true if you want the full log to be sent
+noisy=false
+
+# Addresses for the e-mail
+from="you at yourthing.com"
+to="cia at cia.vc"
+
+# SMTP client to use
+sendmail="/usr/sbin/sendmail -t"
+
+# Changeset URL
+url="http://phpmyadmin.git.sourceforge.net/git/gitweb.cgi?p=phpmyadmin/`basename $PWD`;a=commit;h=@@sha1@@"
+
+# You shouldn't be touching anything else.
+if [[ $# = 0 ]] ; then
+ refname=$(git symbolic-ref HEAD 2>/dev/null)
+ merged=$(git rev-parse HEAD)
+else
+ refname=$1
+ merged=$2
+fi
+
+refname=${refname##refs/heads/}
+
+gitver=$(git --version)
+gitver=${gitver##* }
+
+rev=$(git describe ${merged} 2>/dev/null)
+[[ -z ${rev} ]] && rev=${merged:0:12}
+
+rawcommit=$(git cat-file commit ${merged})
+
+author=$(sed -n -e '/^author .*<\([^@]*\).*$/s--\1-p' \
+ <<< "${rawcommit}")
+
+logmessage=$(sed -e '1,/^$/d' <<< "${rawcommit}")
+${noisy} || logmessage=$(head -n 1 <<< "${logmessage}")
+logmessage=${logmessage//&/&}
+logmessage=${logmessage//</<}
+logmessage=${logmessage//>/>}
+
+ts=$(sed -n -e '/^author .*> \([0-9]\+\).*$/s--\1-p' \
+ <<< "${rawcommit}")
+
+out="
+<message>
+ <generator>
+ <name>CIA Bash client for Git</name>
+ <version>${gitver}</version>
+ <url>http://dev.gentoo.org/~ferdy/stuff/ciabot.bash</url>
+ </generator>
+ <source>
+ <project>${project}</project>
+ <branch>${refname}</branch>
+ </source>
+ <timestamp>${ts}</timestamp>
+ <body>
+ <commit>
+ <author>${author}</author>
+ <revision>${rev}</revision>
+ <files>
+ $(git diff-tree -r --name-only ${merged} |
+ sed -e '1d' -e 's-.*-<file>&</file>-')
+ </files>
+ <log>
+${logmessage}
+ </log>
+ <url>${url//@@sha1@@/${merged}}</url>
+ </commit>
+ </body>
+</message>"
+
+${sendmail} << EOM
+Message-ID: <${merged:0:12}.${author}@${project}>
+From: ${from}
+To: ${to}
+Content-type: text/xml
+Subject: DeliverXML
+${out}
+EOM
+
+# vim: set tw=70 :
+
diff --git a/git-hooks/post-receive b/git-hooks/post-receive
index 34dcf4b..e83343f 100755
--- a/git-hooks/post-receive
+++ b/git-hooks/post-receive
@@ -686,7 +686,9 @@ else
do
generate_email $oldrev $newrev $refname | send_mail
if [ -n "$cia_project" ]; then
- /gitrepo/p/ph/phpmyadmin/scripts/hooks/git-ciabot.pl $newrev $refname
+ for merged in $(git-rev-list $newrev ^$oldrev | tac); do
+ /gitrepo/p/ph/phpmyadmin/scripts/hooks/git-ciabot $merged $refname
+ done
fi
done
fi
hooks/post-receive
--
phpMyAdmin scripts
More information about the Git
mailing list