[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

RE: Precommit hook script for Windows. PLS HELP

From: Mike van Hoof <m.vhoof_at_scheepens.nl>
Date: Fri, 4 Jul 2008 14:25:10 +0200

Hi,
 
as far as i know you can write such a script in bat, or vbs. i made
myslef a post-commit hook as follows:
 
post-commit.bat in the hook dir, which call's a VBS script. works like a
charm. if you want i can try to write this script in VBS
 

Met vriendelijke groet,

Mike van Hoof

Scheepens reclame adviseurs
Post > Postbus 954, 5000 AZ, Tilburg
Bezoek > Sportweg 14, 5037 AC, Tilburg
Telefoon > 013 5950 900
Fax > 013 5950 901
e-mail > m.vhoof_at_scheepens.nl <blocked::mailto:m.vhoof_at_scheepens.nl>
internet > www.scheepens.nl <blocked::http://www.scheepens.nl/>

> Opvallend veelzijdig

 

________________________________

Van: Uzo okoye [mailto:kejike80_at_hotmail.com]
Verzonden: vrijdag 4 juli 2008 14:04
Aan: users_at_subversion.tigris.org
Onderwerp: Precommit hook script for Windows. PLS HELP

Hi,

 

 I am a newbie to Subversion and have no clue to writing scripts!!!

 

I am trying to write a script for windows so that it forces users to add
a bug reference id during a commit.

 

Now for starters

 

I want to know if its possible to write the hook script directly as a
bat file and get it to work or must I to use sth else like Python?

 

Sb helped me write the script in python and in trying to execute it,

 I realised that the I don't have the utility SVNLOOK installed , so to
resolve this I manually copied the file across the bin directory.

I still get errors. I don't know why.

 

This is the python script written for the hook and the corresponding
error message

------------------------------------------------------------------------

---
#!/usr/bin/python
# commit acceptance python client for SVN
 
import os
import re
import sys
import urlparse
 
# configure svnlook path
svnlookPath = '\"C:\\Program Files\\VisualSVN
Server\\bin\\svnlook.exe\"'
 
# get committer
try:
            f = os.popen(svnlookPath + ' author -t ' + sys.argv[2] + ' '
+ sys.argv[1])
            committer = f.read()
            if f.close():
                        raise 1
            committer = committer.rstrip("\n\r")
except:
            print >> sys.stderr, 'Unable to get committer with svnlook.'
            print >> sys.stderr, svnlookPath
            print >> sys.stderr, sys.argv[1]
            print >> sys.stderr, sys.argv[2]
            sys.exit(1)
 
# get commit message
try:
            f = os.popen(svnlookPath + ' log -t ' + sys.argv[2] + ' ' +
sys.argv[1])
            commitMessage = f.read()
            if f.close():
                        raise 1
            commitMessage = commitMessage.rstrip('\n\r')
except:
            print >> sys.stderr, 'Unable to get commit message with
svnlook.'
            print >> sys.stderr, svnlookPath
            print >> sys.stderr, sys.argv[1]
            print >> sys.stderr, sys.argv[2]
            sys.exit(1)
 
# print arguments
# print >> sys.stderr, 'Committer: ' + committer 
print >> sys.stderr, 'Commit message: "' + commitMessage + '"'
 
if (re.match('^[a-zA-Z]+-[0-9]+([\s]+|$)',commitMessage)): 
            print >> sys.stderr, 'Commit accepted.'
            sys.exit(0)
else:
            print >> sys.stderr, 'Commit rejected: This repository
requires a commit message to begin with a REF issue number.\n\reg
REFPRJ-1'
            sys.exit(1)
 
Commit Error Msg
 
 
Command: Commit  
Modified: data\TEST\added2.sql  
Sending content: data\TEST\added2.sql  
Error: Commit failed (details follow):  
Error: Commit blocked by pre-commit hook (exit code 1) with output:  
Error: Unable to get committer with svnlook.  
Error: "C:\Program Files\TortoiseSVN\bin\svnlook.exe"  
Error: C:\data2  
Error: 80-1  
Finished!:   
 
Any help will be appreciated to resolving this.
 
Thanks
 
... Cast your burdens upon the Lord for He cares for you ...
Enough to die for you!!!
________________________________
________________________________
Get fish-slapping on Messenger! Play Now
<http://clk.atdmt.com/UKM/go/101719805/direct/01/>  
Received on 2008-07-04 14:25:45 CEST

This is an archived mail posted to the Subversion Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.