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

Re: Pre-Commit Hook to Manipulate?

From: Felix Gilcher <gilcher_at_exozet.com>
Date: 2006-10-05 16:52:48 CEST

Am 05.10.2006 16:40 Uhr schrieb "Steve.Craft@sungard.com" unter
<Steve.Craft@sungard.com>:

>
>>> From: "Felix Gilcher" <gilcher@exozet.com> [mailto:"Felix Gilcher"
> <gilcher@exozet.com>]
>
>>> Subject: AW: Pre-Commit Hook to Manipulate?
>
>>>
>
> .> It looks like a couple of large XML files with binary-looking CDATA
>
>>> sections are playing with the emotions of my 1.3.2 server (accessed
>
>>> via Apache with SSL and clientside certs). The files commit fine, but
>
>>> they can't be initially checked out.
>
>>>
>
>> The safest way to do this from a precommit hook: Not at all.
>
>> While it may technically be possible you're just inviting trouble to come
>
>> knocking at your door (primary reason: the commit differs from what the
>
>> client thinks it did commit, leading to trouble on the next update because
>
>
>> diffs won't line up etc.).
>
>>
>
>> Instead: go for the autoprops route or write a script that wraps
>
>> the commandline client (or uses the perl/python api). In addition
>
>> write a precommit-hook that checks wether the file conforms to the
>
>> given requirements and if not rejects the commit with a friendly and
>
>> comprehensive message.
>
>
>
>
>
>
>
> Clients are Mac OSX (mostly command line, some using the Java SVN client),
> Win32 Tortoise, Win32 command line, a smattering of Linux clients. Clients
> are in several countries. I was thinking that (en)forcing auto-props on the
> client would be impossible, and would run into trouble when someone commits
> something "out of bounds" and another user somewhere else on the planet
> does a checkout or update and has a problem. I am also not sure that I can
> expect clients to have version n of Python or Perl installed/configured a
> certain way.
>
>
>
> Is there a way in a pre-commit hook to capture "all" of a file's attributes
> (including what the server thinks the file "is")? Maybe I can then do my
> own tests and just reject the file if it doesn't fit all of my criteria.
>

This is what I tried to say. You can write a hook that examines the
transaction in progress (via svnlook) and then decides wether the file and
its properties are ok. While you can not enforce autoprops you can still
enforce a set of properties on a given file (or type of files). Wether the
user then enables autoprops or manually sets the properties each time he
adds a file is up to the user.
Examples for hooks that examine a transaction can be found in the "contrib"
directory on the subversion projects subversion server or in the source
distribution.

>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
> For additional commands, e-mail: users-help@subversion.tigris.org
>

Regards

felix

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Thu Oct 5 16:54:13 2006

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.