SVN post- commit for Windows. As I mentioned early I've been working on a SVN post- commit script. We've got a SVN repository that will be modified by several remote developers and I really need to keep an eye on this repository and I need to closely monitor changes to this repository. There are two major functions that I needed in my post- commit script: I needed to update the working copy on my server I needed to e- mail the changes to myself, so I know when developers are making changes There are an abundant of examples showing off how to do this in various *nix flavors, but I couldn't find any good Windows- based solutions that didn't require Perl to be installed on the server. That led me to create the following post- commit. ECHO OFF. REM *************************************************************. Tool Description Version Links; AAClr: Change Aero colors to match wallpaper: 1.0.2 April 15, 2013: Info; Download. BowPad: A simple and fast text editor with a ribbon UI. ![]() ![]() Make some changes; svn commit; If your changes involve creating new files, there’s a tricky extra step: Make some changes; svn add; svn commit; For a Github-hosted. Jono's Linux Top Tips by Jono Woodhouse----- : Jono Woodhouse Version 2.22. REM * this sets the arguments supplied by Subversion *. REM *************************************************************. REM *************************************************************. REM * define directory paths *. REM * you *must* add any paths for command line tools you plan *. REM * since SVN does not include the Windows %PATH% environment *. REM * variable for security reasons. REM * *. REM * DIR - the current hooks directory *. REM * PATH - a user set path of where executables are located *. Tortoise Svn Commit Monitor Download Volume![]() REM * *. REM *************************************************************. SET DIR=%REPOS%/hooks.
REM *************************************************************. REM * make sure to add the path to the Send. Email executable *. REM *************************************************************. SET PATH=%PATH%; %DIR%; C: \Utils. REM *************************************************************. REM * define the path to the working copy of your code *. REM * *. REM * the default working_copy folder would be: *. REM * file: ///%REPOS% *. REM *************************************************************. SET WORKING_COPY=c: \path\to\working\copy. REM *************************************************************. REM * define e- mail parameters *. REM *************************************************************. SET SITENAME=My Code Base. SET SMTP_SERVER=smtp. SET EMAIL_TO=svnupdates@yourdomain. SET EMAIL_FROM=svnupdates@yourdomain. SET SUBJECT=SVN Update - %SITENAME% - rev %REV% - %REPOS%. REM *************************************************************. REM * update the local working copy *. REM * this will sync the new changes to your servers copy *. REM *************************************************************. WORKING_COPY%. REM *************************************************************. REM * generate the header to use for the e- mail message *. REM *************************************************************. ECHO The following changes were made to the code: > %DIR%/email. ECHO. > > %DIR%/email. REM *************************************************************. REM * dump the log of changes to the e- mail message *. REM *************************************************************. WORKING_COPY% - v - r "%REV%" > > %DIR%/email. REM *************************************************************. REM * dump the diff changes to the e- mail message *. REM * *. REM * WARNING: Generates tons of output *. REM * *. REM * NOTE: this is optional, you can remove this information *. REM * if you do not want a verbose message of changes *. REM *************************************************************. WORKING_COPY% - c "%REV%" - -no- diff- deleted > > %DIR%/email. REM *************************************************************. REM * send the e- mail message to the user *. REM * *. REM * NOTE: to create a Send. Email. log file, append: *. REM * *. REM * - l %DIR%/Send. Email. log *. REM * *. REM * at the end of the line below. REM *************************************************************. Email - s %SMTP_SERVER% - t %EMAIL_TO% - f %EMAIL_FROM% - u "%SUBJECT%" - o message- file=%DIR%/email. A couple of notes on the script above: You'll need to download Send. Email in order to send the e- mail messages. In the environmental variable %PATH% you'll want to make sure to include the path where you copied the Send. Email. exe. In the example above, the Send. Email. exe is located in the C: \Utils directory. Make sure to go through the script and replace any variables declared with the SET command with the values that coorelated to your environment. In my case I required a working copy to be placed on my server, as it's used as a global development environment. If you do not require a local working copy, you can comment out the svn update %WORKING_COPY% line (by placing the command REM in front of the line.) You would then change your WORKING_COPY variable to the URL of your SVN repository—which would be file: ///%REPOS%. The svn diff command can generate a ton of information. In most use cases, you probably do not want to add this information to the e- mail output. If you have any problems getting this script working, I recommend you check out my blog entry on debugging SVN repository hook scripts in Windows.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |