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

RE: Hook to check for a presence of file before committing

From: REEDICK, ANDREW (ATTSI) <ar345x_at_att.com>
Date: Tue, 31 Aug 2010 15:56:18 -0400

A pre-commit hook can determine if a file exists in the checkin
transaction. A pre-commit hook can look at the repository to see if a
file already exists in the repository.

A pre-commit CANNOT verify that a file exists in the user's workspace.

 

"script will check for the presence of project.xml"

A lot of the confusion exists because you weren't being clear enough
about whether you're asking to check if the file exists in the user's
workspace or if it exists in the commit transaction.

 

So yes, a pre-commit hook can check if a commit (check-in) does contain
a changed project.xml file.

 

 

From: Tech Geek [mailto:techgeek12345_at_gmail.com]
Sent: Tuesday, August 31, 2010 1:59 PM
To: Les Mikesell
Cc: users_at_subversion.apache.org
Subject: Re: Hook to check for a presence of file before committing

 

>Is it a requirement that the file be changed each time (and thus part
of a commit), or just that it exists somewhere on the client side
>(versioned or unversioned)? The server will only know about it when it
changes since the svn client is smart enough to only send >differences.

Great question. Let me walk through a scenario.

 

Let's say if somehow we do manage to implement this hook before the
development/project begins then after the first revision/commit the
project.xml file will also be committed (because we reject any commit if
that file is not there). Now let's say the development further goes on
and now it is time to commit second time. At this time our hook script
again will check for the presence of project.xml file and will also
check if the project.xml got changed or not. If it got changed that
means the developer did produce a new version of this file and we accept
the commit. If the version of the file did not change then we reject it.

 
Received on 2010-08-31 21:57:12 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.