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

Re: Why not just enforce auto-props with a hook script that sets the right properties

From: Mark E. Hamilton <mhamilt_at_sandia.gov>
Date: Tue, 10 Jun 2008 15:13:34 -0600

Peter Kahn wrote:
> Is there a reason why I shouldn't take check-mime-type.pl a step further
> and have my hook script set properties on newly added files according to
> a repository wide policy?

 From the book

While hook scripts can do almost anything, there is one dimension in
which hook script authors should show restraint: do not modify a commit
transaction using hook scripts. While it might be tempting to use hook
scripts to automatically correct errors or shortcomings or policy
violations present in the files being committed, doing so can cause
problems. Subversion keeps client-side caches of certain bits of
repository data, and if you change a commit transaction in this way,
those caches become undetectably stale. This inconsistency can lead to
surprising and unexpected behavior. Instead of modifying the
transaction, you should simply validate the transaction in the
pre-commit hook and reject the commit if it does not meet the desired
requirements. As a bonus, your users will learn the value of careful,
compliance-minded work habits.

Mark E. Hamilton
Orion International Technologies, Inc.
Sandia National Laboratory, NM.
To unsubscribe, e-mail: users-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: users-help_at_subversion.tigris.org
Received on 2008-06-10 23:14:17 CEST

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.