On Aug 17, 2009, at 18:19, Andy Levy wrote:
> On Mon, Aug 17, 2009 at 19:05, Douglas Bullard 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
> 4) What happens if, for another reason, your commit fails?
Andy, you're supposing that Douglas is doing a second commit in a
post-commit hook, after the user's commit, to make additional
changes. That would be a way to do it, though problematic for the
reasons you stated.
But my reading of his request is that he is wanting to modify the
user's original transaction as it occurs, in the pre-commit hook,
which is much worse, because after the commit of the revision (call
it "R"), the committer's working copy will not be marked as out of
date -- will think it is up-to-date -- yet will not contain exactly
what's in the repository. What the working copy thinks revision R is
and what the repository thinks revision R is will be two different
things. Therefore on subsequent updates of the working copy, the diff
that the server sends to the client may not apply properly on the
client and cause the update to fail.
>> 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/
>> 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 02:50:42 CEST