« 旭山動物園ツーリング | Main | 網走へ »

svnのコミット時にメールを送信する方法のメモ

  • メール送信スクリプトのサンプル(/usr/share/doc/subversion-1.4.2/tools/hook-scripts/のcommit-email.pl)をリポジトリディレクトリ配下のhooksディレクトリにコピー
  • リポジトリディレクトリ配下のhooksディレクトリにあるpost-commit.tmplをpost-commitにコピー
  • post-commitを以下のように編集
    変更前:
    REPOS="$1"
    REV="$2"
    commit-email.pl "$REPOS" "$REV" commit-watchers@example.org
    log-commit.py --repository "$REPOS" --revision "$REV"


    変更後:
    export LANG=ja_JP.UTF8  ← 日本語対応のため追加
    REPOS="$1"
    REV="$2"
    TO="送信したいメールアドレス"
    /export/svn/prime/hooks/commit-email.pl "$REPOS" "$REV" -s "subject" $TO
    #log-commit.py --repository "$REPOS" --revision "$REV"
  • メール送信スクリプト(commit-email.pl)を日本語に対応するよう変更
    変更箇所
    push(@head, "Content-Type: text/plain; charset=UTF-8\n");
    push(@head, "Content-Transfer-Encoding: 8bit\n");

    push(@head, "Content-Type: text/plain; charset=iso-2022-jp\n");
    push(@head, "Content-Transfer-Encoding: 7bit\n");


    my $command = "$sendmail -f'$mail_from' $userlist";

    my $command = "nkf | $sendmail -f'$mail_from' $userlist";

以下は、送信されたメールの例

Author: sliver
Date: 2008-07-22 15:06:49 +0900 (火, 22  7月 2008)
New Revision: 45

Modified:
  trunk/doc/test.txt
Log:
日本語のコメント

変更: trunk/doc/test.txt
===================================================================
--- trunk/doc/test.txt    2008-07-22 06:04:50 UTC (rev 44)
+++ trunk/doc/test.txt    2008-07-22 06:06:49 UTC (rev 45)

|

« 旭山動物園ツーリング | Main | 網走へ »

Comments

Post a comment



(Not displayed with comment.)


Comments are moderated, and will not appear on this weblog until the author has approved them.



TrackBack

TrackBack URL for this entry:
http://app.cocolog-nifty.com/t/trackback/63164/41934778

Listed below are links to weblogs that reference svnのコミット時にメールを送信する方法のメモ:

« 旭山動物園ツーリング | Main | 網走へ »