You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by "Butler, Frances H (FHB)" <bu...@y12.doe.gov> on 2005/05/31 14:24:32 UTC
Modifying Erik's script for Windows
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 <ja...@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])
Re: Modifying Erik's script for Windows
Posted by Norbert Unterberg <ne...@gmx.net>.
Butler, Frances H (FHB) schrieb:
> 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.
If that is all you want, you could set the tsvn:minlogsize property on
your projects. This instructs TSVN to disable the OK button in the
commit dialog until the user has entered a log message of the defined
length.
Norbert
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Re: Modifying Erik's script for Windows
Posted by Jacques Marneweck <ja...@powertrip.co.za>.
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
binary.
> 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
>
Regards
--jm
> #!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 <ja...@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
http://www.powertrip.co.za/blog/
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Re: Modifying Erik's script for Windows
Posted by Norbert Unterberg <ne...@gmx.net>.
Butler, Frances H (FHB) schrieb:
> 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.
If that is all you want, you could set the tsvn:minlogsize property on
your projects. This instructs TSVN to disable the OK button in the
commit dialog until the user has entered a log message of the defined
length.
Norbert
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org