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

Re: Modifying Erik's script for Windows

From: Jacques Marneweck <jacques_at_powertrip.co.za>
Date: 2005-05-31 16:49:26 CEST

Butler, Frances H (FHB) wrote:

Hi Frances,

> I read with interest Jacques' post of a pre-commit hook. (Text of his
> original script is included below.) It came at a great time. I have
> a need for just such a script, but my installation is using a svn
> repository on a Windows 2003 Server.
> I would like to modify this script according. I realize I need to
> change the path to Python and the "SVNLOOK" statement to point to the
> directory where our installation of Subversion lies.
You would most likely need to link the the exact location of the python
binary and the svnlook binary. For example if your svnlook binary is
located in the C:\Program Files\Subversion\bin\ folder, you would need
to use C:\Program Files\Subversion\bin\svnlook.exe for the file it needs
to execute. Also you are going to need the exact location of the python

> Thus, I think I have something like the following. Note my changes in
> red.
> I have not yet tested this, and I might need to check my path
> variable, right?
> Jacques, if you or anyone else on the users forum have suggestions for
> me, I would greatly appreciate it.
> Frances

> #!c:\Python23
> """
> Subversion pre-commit hook which currently checks that the commit
> contains
> a commit message to avoid commiting empty changesets which tortoisesvn
> seems
> to have a habbit of committing.
> Based on
> _http://svn.collab.net/repos/svn/branches/1.2.x/contrib/hook-scripts/commit-block-joke.py_
> and hooks/pre-commit.tmpl
> Hacked together by Jacques Marneweck <jacques@php.net>
> $Id$
> """
> import sys, os, string
> SVNLOOK='C:\Program Files\Subversion\bin'
> def main(repos, txn):
> log_cmd = '%s log -t "%s" "%s"' % (SVNLOOK, txn, repos)
> log_msg = os.popen(log_cmd, 'r').readline().rstrip('\n')
> if len(log_msg) < 10:
> sys.stderr.write ("Please enter a commit message which details
> what has changed during this commit.\n")
> sys.exit(1)
> else:
> sys.exit(0)
> if __name__ == '__main__':
> if len(sys.argv) < 3:
> sys.stderr.write("Usage: %s REPOS TXN\n" % (sys.argv[0]))
> else:
> main(sys.argv[1], sys.argv[2])

Jacques Marneweck
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Tue May 31 19:27:01 2005

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.