2

I have a couple of FSFS based file system SVN repositories that I wish to switch to be read only. Is there a flag I can enable that will stop svn clients from writing to the repository?

Alternatively I could simply remove all write permissions from the folder, but that feels overkill.

bahrep
  • 29,961
  • 12
  • 103
  • 150
Neil P
  • 2,920
  • 5
  • 33
  • 64

2 Answers2

2

Use svnadmin freeze to make your repos read-only or configure user or filesystem permissions so that noone could commit. Proper approach depends on the actual task you have but I guess that svnadmin freeze should help you in most cases.

svnadmin freeze is available starting with Subversion 1.8. Make sure that your Subversion is up-to-date.

bahrep
  • 29,961
  • 12
  • 103
  • 150
2

One option is to use start-commit hook with content like this:

echo "Repository is readonly"
exit 1
bahrep
  • 29,961
  • 12
  • 103
  • 150
Ivan Zhakov
  • 3,981
  • 28
  • 24
  • @NeilP Repository hooks behavior doesn't depend on repository type. What OS do you use? – Ivan Zhakov Jan 12 '16 at 16:57
  • I'm on windows, it's one of those nasty fsfs repos on a network share (hence why I want to kill it!) – Neil P Jan 12 '16 at 16:59
  • @NeilP Make sure that you created batch file for the hook. I.e. ``repos\hooks\start-commit.bat`` – Ivan Zhakov Jan 12 '16 at 17:02
  • 1
    @NeilP Great! Btw ``svnadmin freeze`` may not work correctly if repository on NFS share and users are accessing it directly. So start-commit hook solution may be better in your case. – Ivan Zhakov Jan 12 '16 at 17:05
  • That's what I had found, it looks like the correct way of doing this, but maybe not in my case. – Neil P Jan 12 '16 at 17:06
  • 1
    @NeilP ``svnadmin freeze`` is designed for backups, not for locking repository. The ``svnadmin freeze`` command obtains temporary lock and will be released once ``svnadmin freeze`` command finished. – Ivan Zhakov Jan 12 '16 at 18:50