Discussions  >  CollabNet Subversion Admins  >  RE: Re: Create or modify hook script to send generic message ?

Back to topic list

RE: Re: Create or modify hook script to send generic message ?

Author phil_pinkerton (OCN Member)
Full name Phil Pinkerton
Date 2012-03-22 08:26:42 PDT
Message Not real confidentabout the redirect. However I alomst have the post-commit hook working. Just need to figure out why a command works on the command line but not from the hook script. It is the $NEW variable that works on the command line but gives the wrong output when ran from the hook script:

Here is the post-commit:

#
# Repository Specific hook script goes here
#

REPOS="$1"
REV="$2"
CMTBY=`svnlook author $REPOS`
COMP="mycompany.com"
DATE=`svnlook date $REPOS`
COMMENTS=`svnlook log $REPOS`
FILES=`svnlook changed $REPOS`
NEW=`echo $REPOS | sed '/svn01t.nwie/ s/svn01t.nwie/svntest.nwie/g' | sed '/svntest.nwie/ s/svn01t\/svn\/Rep​ositories/svn/g'`

MSG="NOTICE: Subversion TEST Server svn01t.nwie.net is being replace March 31st 2012\n\n Please use the following New URL for your Test Repositories\n\n $NEW\n\nCommitted By: $CMTBY\n\nDate: $DAT
E\n\nModified Folder Path and Files: \n$FILES \n\nRevision #: $2\n\nComments: $COMMENTS"

echo $MSG | mailx -s "Subversion Commit message $CMTBY" $CMTBY$COMP

When ran on the command line $NEW looks like this echo $NEW
https://svntest.nwie​.net/svn/Gandalf

but the resulting email $NEW looks like this

 /svn01t/svn/Reposito​ries/Gandalf

The other variables and email messages all look good.

Here is the full email result after I do a commit my self.

NOTICE: Subversion TEST Server svn01t.nwie.net is being replace March 31st 2012

 Please use the following New URL for your Test Repositories

 /svn01t/svn/Reposito​ries/Gandalf

Committed By: pinkerp1

Date: 2012-03-22 11:07:21 -0400 (Thu, 22 Mar 2012)

Modified Folder Path and Files:
U branches/svnprodRepoUse.txt

Revision #: 58

Comments: wow

The URL in the email should match $NEW variable like on the command line.

« Previous message in topic | 4 of 8 | Next message in topic »

Messages

Show all messages in topic

Create or modify hook script to send generic message ? pcpinkerton (OCN Member) Phil Pinkerton 2012-03-21 04:05:43 PDT
     RE: Create or modify hook script to send generic message ? markphip (OCN Member) Mark Phippard 2012-03-21 04:41:12 PDT
     Re: Create or modify hook script to send generic message ? cmpilato (OCN Member) C. Michael Pilato 2012-03-21 09:16:16 PDT
         RE: Re: Create or modify hook script to send generic message ? phil_pinkerton (OCN Member) Phil Pinkerton 2012-03-22 08:26:42 PDT
             Re: Create or modify hook script to send generic message ? cmpilato (OCN Member) C. Michael Pilato 2012-03-22 09:05:24 PDT
                 RE: Re: Create or modify hook script to send generic message ? phil_pinkerton (OCN Member) Phil Pinkerton 2012-03-22 11:00:46 PDT
                     Re: Create or modify hook script to send generic message ? cmpilato (OCN Member) C. Michael Pilato 2012-03-22 11:20:18 PDT
                         RE: Re: Create or modify hook script to send generic message ? phil_pinkerton (OCN Member) Phil Pinkerton 2012-03-22 13:25:01 PDT
Messages per page: