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

Re: query for the root of the working directory?

From: Ryan Schmidt <subversion-2006Q1_at_ryandesign.com>
Date: 2006-01-11 23:47:22 CET

On Jan 11, 2006, at 19:19, Nathan Lewis wrote:

> Is there a way in subversion to get the root of the working copy? I
> am seeking to write a pre-commit hook that runs tests on the
> committed files but I need to run them from within the user's
> working copy.

You do realize that the pre-commit hook runs on the server, and the
working copy is located on the client, and so the hook script never
has access to the client's working copy?

Unless of course all your users' working copies are stored on the
same machine that serves as the repository server. We happen to have
things set up that way at work, accessing the working copies via SMB
and SSH, but every time I mention it on this list, people think I'm
nuts, so I don't think it's the way most people use Subversion.

Even if you are set up that way, once a transaction comes in to the
repository and your hook is called, the hook will only know what path
within the repository the transaction is trying to affect; it won't
know the path to the working copy that caused the commit. You would
have to define a policy for your users, such as "Thou shalt always
put your working copies in ~/working_copies and must always name the
directories exactly as they appear in the repository" so that you
would have some chance of programmatically locating the working copy.
That would seem to restrict your users to a single working copy of
each project, though, a limitation I would not be pleased to have to
deal with, were it imposed on me...

Don't forget that the user may have other files in their working copy
which they haven't committed yet, so it doesn't seem like a very good
idea to try to use their working copy as a basis for allowing or
denying a transaction.

Others who have the need to have a working copy in order to verify a
transaction (for example, because they want to compile checked-in
code, and prevent the commit if the build fails) have the hook script
maintain its own private working copy for this purpose.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Wed Jan 11 23:51:36 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.