Difference between revisions of "SVN Tips"
LeonTorres (talk | contribs) (New page: == Setting up Commit Emails == Before we begin, ensure that mail can be sent from the server on which the subversion repository lives. This can be as simple as running the mail program f...) |
LeonTorres (talk | contribs) |
||
(4 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
== Setting up Commit Emails == | == Setting up Commit Emails == | ||
− | Before we begin, ensure that mail can be sent from the server on which the subversion repository lives. | + | Before we begin, ensure that mail can be sent from the server on which the subversion repository lives. If you're on a UNIX OS, this can be done by running the mail program from the command line, |
− | + | prompt:> mail -s "test subject" someone@somewhere.com | |
− | prompt:> mail -s "test subject" someone@somewhere.com | + | Type in body of email and press CTRL-D to send. |
− | Type in body of email and press CTRL-D to send. | + | ^D |
− | ^D | + | prompt:> |
− | |||
Next, go to the <tt>hooks/</tt> directory of our subversion repository. It should contain several files ending in <tt>.tmpl</tt>. These are shell script templates that allow you to hook actions to subversion events. In particular, we are looking for <tt>post-commit.tmpl</tt> which we will use to send email whenever a commit is made. | Next, go to the <tt>hooks/</tt> directory of our subversion repository. It should contain several files ending in <tt>.tmpl</tt>. These are shell script templates that allow you to hook actions to subversion events. In particular, we are looking for <tt>post-commit.tmpl</tt> which we will use to send email whenever a commit is made. | ||
− | + | * Ensure that <tt>commit-email.pl</tt> exists in <tt>hooks/</tt> directory. If you cannot find it, [http://subversion.tigris.org/tools_contrib.html#commit_email_pl get it from here]. | |
− | + | * Create a copy of <tt>post-commit.tmpl</tt> named <tt>post-commit</tt> | |
− | + | * Edit <tt>post-commit</tt> and add the following before the call to <tt>commit-email.pl</tt> | |
− | + | PATH=/path/to/subversion/hooks | |
− | PATH=/path/to/subversion/hooks | ||
− | |||
− | + | * Comment out log-commit.py if present, it's not necessary. This script only needs to do commit-email.pl | |
− | + | * Specify the email or space separated list of emails to send these commit notifications to as the last arguments to commit-email.pl | |
− | + | * Make sure that commit-email.pl and post-commit are executable by anyone | |
− | + | chmod a+x commit-email.pl post-commit | |
− | chmod a+x commit-email.pl post-commit | ||
− | |||
This should basically be it. Commit something to test things out. If there is a problem, it will usually show up in the mail server logs. The next sections cover possible issues. | This should basically be it. Commit something to test things out. If there is a problem, it will usually show up in the mail server logs. The next sections cover possible issues. | ||
Line 32: | Line 27: | ||
If you're running svnserve to allow checkout using svn:// URL notation, then you have to make sure that the user that runs svnserve can also read and execute the scripts in hooks/. Make sure this user owns that directory and all files in it. | If you're running svnserve to allow checkout using svn:// URL notation, then you have to make sure that the user that runs svnserve can also read and execute the scripts in hooks/. Make sure this user owns that directory and all files in it. | ||
+ | |||
+ | You might also want to make sure this user can send emails to the mailserver. Log in as the user and use the mail command to test this. |
Latest revision as of 00:40, 27 March 2008
Setting up Commit Emails
Before we begin, ensure that mail can be sent from the server on which the subversion repository lives. If you're on a UNIX OS, this can be done by running the mail program from the command line,
prompt:> mail -s "test subject" someone@somewhere.com Type in body of email and press CTRL-D to send. ^D prompt:>
Next, go to the hooks/ directory of our subversion repository. It should contain several files ending in .tmpl. These are shell script templates that allow you to hook actions to subversion events. In particular, we are looking for post-commit.tmpl which we will use to send email whenever a commit is made.
- Ensure that commit-email.pl exists in hooks/ directory. If you cannot find it, get it from here.
- Create a copy of post-commit.tmpl named post-commit
- Edit post-commit and add the following before the call to commit-email.pl
PATH=/path/to/subversion/hooks
- Comment out log-commit.py if present, it's not necessary. This script only needs to do commit-email.pl
- Specify the email or space separated list of emails to send these commit notifications to as the last arguments to commit-email.pl
- Make sure that commit-email.pl and post-commit are executable by anyone
chmod a+x commit-email.pl post-commit
This should basically be it. Commit something to test things out. If there is a problem, it will usually show up in the mail server logs. The next sections cover possible issues.
Permission Denied
If you're running svnserve to allow checkout using svn:// URL notation, then you have to make sure that the user that runs svnserve can also read and execute the scripts in hooks/. Make sure this user owns that directory and all files in it.
You might also want to make sure this user can send emails to the mailserver. Log in as the user and use the mail command to test this.