본문 바로가기
Research/Linux

subversion: commit시 메일 보내기

by sunnyan 2009. 5. 7.
728x90
몇가지 방법이 있는데, 다른 방법은 실패하고 아래 방법이 쉽게 되었다...

먼저 mailer.py란 파이썬 스크립트 파일이 필요하다. 이 파일은 subversion 소스 디렉토리(/usr/share/doc/subversion-1.4.4/tools/hook-scripts/mailer/)에 존재하는데, 이 파일을 특정 디렉토리에 카피한다. 특별히 mailer.py를 수정할 일이 없다면 그냥 원래 위치에
놓고 사용해도 무방하다.

그 다음으로 subversion repository 디렉토리 밑의 hooks 디렉토리에 위의 subversion 소스 디렉토리의 위 경로 밑에 mailer.conf.example 파일을 mailer.conf 로 rename해서 카피한다. 그런 다음 아래와 같이 수정한다.


# This option specifies the hostname for delivery via SMTP.
smtp_hostname = smtp.domain.com

# Username and password for SMTP servers requiring authorisation.
smtp_username = sunny@domain.com
smtp_password = (이메일 암호)

# The default To: addresses for message.  One or more addresses,
# separated by whitespace (no commas):
to_addr = (commit 이메일을 받을 사람의 이메일주소)



그런 후에 hooks 디렉토리에 있는 post-commit.tmpl 파일을 post-commit으로 이름을 변경하고 속성을 755을 바꿔주어야 한다.
post-commit이 commit시에 실행되는 스크립트 파일이기 때문이다...

post-commit 파일을 보면 commit-email.pl 이란 perl script 파일을 실행하도록 되어 있으나 위에서 말한것 처럼
이 방법으로는 성공하지 못했다...

따라서 commit-email.pl 을 실행하는 부분은 주석처리 해주고 아래와 같이 수정한다.

(mailer.py가 존재하는 경로)/mailer.py commit "$REPOS" "$REV" (mailer.conf의 절대경로)/mailer.conf


이렇게 한 후 commit 하면 commit 시 마다 commit 내용이 메일로 전달된다.

728x90