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

Re: Create a read-only always updated working copy

From: Kevin Grover <kevin_at_kevingrover.net>
Date: Sat, 31 May 2008 10:07:31 -0700

On Sat, May 31, 2008 at 9:39 AM, rouble <rouble_at_gmail.com> wrote:
> SVN gurus,
>
> I have a tools directory that contains many executable perl scripts:
> /path/to/tools
>
> I wanted to add this to svn, so I did this:
> ~$ svnadmin create /path/to/svn

Just a note: I would create an empty directory called 'svn' and then
'svmadmin create' a repository called 'tools' there (svnadmin create
/path/to/svn/tools). This way, you can add new repositories at any
time. This is personal preference, the rest of my response will be
based on the way you set things up.

> ~$ svn mkdir file:///path/to/svn/trunk -m "Adding trunk"
> ~$ svn mkdir file:///path/to/svn/branches -m "Adding branches"
> ~$ svn mkdir file:///path/to/svn/tags -m "Adding tags"

Just a note: You can save some commits:
svn mkdir file:///path/to/svn/{trunk,tags,branches} -m "Initiial
directory structure"

Creates all three base directories in one commit using bash {}
expansion. You can also explicitly type all three URLs, but manually
repeating them (IMO) is error prone

> ~$ svn mkdir file:///path/to/svn/trunk/tools -m "Adding tools"
> ~$ svn import /path/to/tools/ file:///path/to/svn/trunk/tools -m
> "Initial import"
>
> Now, I have /path/to/tools in my svn repository. So far so good.
>
> Now, I want to pull a read-only always updated working copy in
> /path/to/tools. So, users can still cd into /path/to/tools and execute
> the perl scripts just like they used to. But users should not be able
> to edit any of these files in that working copy.

You must check out a working copy in place of the current directory. One way

cd /path/to
# Delete current 'tools' directory (it's all in the repository now)
rm -rf tools
# Check out a new, svn managed, 'tools' directory
svn co file:///path/to/svn/trunk tools

You should also set the owner of the tools directory and files such
that only they have write permission: everyone else is read-only.

> Also, whenever someone commits something to the repository, I want
> /path/to/tools to get automatically updated; so users of the scripts
> always have the latest version.

You must create a svn post-commit hook script. This script, upon a
successful commit, would just 'svn update' the /path/to/tools working
copy (as the correct user).

You can see an example at /path/to/svn/conf/post-commit.tmpl. See the
manual for more details.

> I saw that there is a svnsync tool in svn 1.4+, that can help me
> achieve what I want, but we only have svn 1.3.2 installed on our
> machines here... and there is no plan of an upgrade anytime soon. Is
> there another way to do what I want to do?

svnsync to to keep extra (synced) copies of 'repositories'. It won't
help you: you need to keep a working copy up-to-date.

- Kevin

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: users-help_at_subversion.tigris.org
Received on 2008-05-31 19:07:55 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.