You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Jacques Marneweck <ja...@powertrip.co.za> on 2005/05/27 14:15:29 UTC
Subversion pre-commit hook script
Hi,
I've quickly hacked together a pre-commit script using python as I was
having issues with the pre-commit.tmpl which is installed as part of the
subversion repository creation. You may want to include it as part of
the contrib for subversion.
Regards
--jm
--
Jacques Marneweck
http://www.powertrip.co.za/blog/
Re: Subversion pre-commit hook script
Posted by kf...@collab.net.
Jacques Marneweck <ja...@powertrip.co.za> writes:
> kfogel@collab.net wrote:
>
> >>I've quickly hacked together a pre-commit script using python as I was
> >>having issues with the pre-commit.tmpl which is installed as part of
> >>the subversion repository creation. You may want to include it as
> >>part of the contrib for subversion.
> >
> >What issues were you having?
>
> When enabling the check for blank log messages it rejected commits
> with log messages which was not the expected behaviour.
I would rather understand why you were having this unexpected problem
than add a redundant new script to our contrib/ area...
Did you determine what was wrong with the existing code?
-Karl
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: Subversion pre-commit hook script
Posted by Ben Collins-Sussman <su...@collab.net>.
On May 30, 2005, at 4:37 AM, Jacques Marneweck wrote:
>>
>>> I've quickly hacked together a pre-commit script using python as
>>> I was
>>> having issues with the pre-commit.tmpl which is installed as part of
>>> the subversion repository creation. You may want to include it as
>>> part of the contrib for subversion.
>>>
Jacques,
I hope you don't take offense, but you've taken a trivial 4-line
bourne script and rewritten it into an identically trivial 4-line
python script. There's nothing particularly interesting about that,
so I'm not sure why it should be subversion's contrib/ area.
What *would* be interesting is to find out why the original snippet
wasn't working on your system. There's no obvious explanation for
that, and we've never seen it reported before. If you really want to
contribute to the community, please help us investigate whatever
anomaly you've discovered.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: Subversion pre-commit hook script
Posted by Jacques Marneweck <ja...@powertrip.co.za>.
kfogel@collab.net wrote:
>Jacques Marneweck <ja...@powertrip.co.za> writes:
>
>
>>I've quickly hacked together a pre-commit script using python as I was
>>having issues with the pre-commit.tmpl which is installed as part of
>>the subversion repository creation. You may want to include it as
>>part of the contrib for subversion.
>>
>>
>
>What issues were you having?
>
>
When enabling the check for blank log messages it rejected commits with
log messages which was not the expected behaviour.
Regards
--jm
>
>
>
>>Regards
>>--jm
>>
>>--
>>Jacques Marneweck
>>http://www.powertrip.co.za/blog/
>>
>>#!/usr/local/bin/python
>>"""
>>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='/usr/local/bin/svnlook'
>>
>>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])
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
>>For additional commands, e-mail: dev-help@subversion.tigris.org
>>
>>
>
>
>
--
Jacques Marneweck
http://www.powertrip.co.za/blog/
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: Subversion pre-commit hook script
Posted by kf...@collab.net.
Jacques Marneweck <ja...@powertrip.co.za> writes:
> I've quickly hacked together a pre-commit script using python as I was
> having issues with the pre-commit.tmpl which is installed as part of
> the subversion repository creation. You may want to include it as
> part of the contrib for subversion.
What issues were you having?
> Regards
> --jm
>
> --
> Jacques Marneweck
> http://www.powertrip.co.za/blog/
>
> #!/usr/local/bin/python
> """
> 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='/usr/local/bin/svnlook'
>
> 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])
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
> For additional commands, e-mail: dev-help@subversion.tigris.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org