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

Re: Pre-commit hooks and access to files

From: Andy Levy <andy.levy_at_gmail.com>
Date: Mon, 17 Aug 2009 19:19:26 -0400

On Mon, Aug 17, 2009 at 19:05, Douglas Bullard<dbullard_at_nurflugel.com> wrote:
> I'm investigating whether it's possible to modify the contents of
> files in pre-commit hooks (such as inserting author's names and
> revision numbers in class comments, etc).
> The docs for pre-commit hooks say that modification of the
> contents of a transaction are prohibited.  Would this preclude me
> from doing this?

It's probably technically possible (though rather tricky &
error-prone), but it's a very, very bad idea for reasons that have
been covered many times on this list.

1) The committer's working copy is immediately out of sync with what
is in the repository
2) The committer doesn't *really* know what's being committed in his name
3) A bad substitution could break code that was working when you began
the commit.
3a) There's no good way to do any validation of what you're committing.
4) What happens if, for another reason, your commit fails?

> If not, how would I get a handle of the file contents to modify -
> svnlook doesn't seem to do this.

Use keywords. http://svnbook.red-bean.com/en/1.5/svn.advanced.props.special.keywords.html

> I understand that people have strong opinions on this, but I'm
> investigating whether it's possible, the advisabitlity of doing so
> is another conversation.

Theoretically, it's possible to fall out of an airplane and survive.
But that doesn't mean you should do it.


To unsubscribe from this discussion, e-mail: [users-unsubscribe_at_subversion.tigris.org].
Received on 2009-08-18 01:20:25 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.