5
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Subversionでコミットメールを送信する

Last updated at Posted at 2015-04-20

概要

svnコミット時にコミットログをメール送信する。
mailer.pyでやるやり方ではうまくいかなかったので、mailコマンドでやってみた。

環境

  • Mail version 8.1 6/6/93.

手順

hookスクリプトをコピーし、実行権限を付与

$ cd /path/to/repository/hooks
$ cp -p post-commit.tmpl post-commit
$ chmod +x post-commit

post-commitを編集

post-commit
# 文字化け対策
export LANG=ja_JP.utf8

REPOS="$1"
REV="$2"

TITLE="Subversion committed to repos ${REV}"
FROM_ADDR="no-reply@hoge.com"
TO_ADDR="hoge@hoge.jp"

# コミットユーザ
COMMIT_AUTOER=`svnlook author -r ${REV} ${REPOS}`
# コミットログ
COMMIT_LOG=`svnlook log -r ${REV} ${REPOS}`
# コミットファイル
COMMIT_FILES=`svnlook changed -r ${REV} ${REPOS}`

echo -e "${COMMIT_AUTOER}\n\n${COMMIT_LOG}\n\n${COMMIT_FILES}" | mail -s "${TITLE}" ${TO_ADDR} -- -f ${FROM_ADDR}

5
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?