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

Modifying Erik's script for Windows

From: Butler, Frances H (FHB) <butlerfh_at_y12.doe.gov>
Date: 2005-05-31 16:24:32 CEST

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.

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-bl
ock-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])
Received on Tue May 31 16:28:05 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.