2

There are some new consultants, who shall be working on parts of a software which aren't functionally critical to the overall software. The software is not organized in a modular fashion, s.t. all of these source-files that hold the non-critical functionality, are not isolated in a directory.

Is there a way such that, the consultants are not able to fork/branch the project, and also can work only on files (the non critical functionality files) ?

The version-control software is SVN in this case.

bdutta74
  • 2,798
  • 3
  • 31
  • 54

2 Answers2

3

If you use VisualSVN Server on Windows you can easily set access (eg read-only or no-access) permissions on the directories. You cannot set anything on a per-file basis in SVN (it was designed to operate on directories). Other SVN systems can do the same by editing the authz file and editing an entry for each directory you want protected.

Setting access controls on individual files will quickly become a nightmare, so move the files you want protecting into a couple of directories and put your controls on them.

gbjbaanb
  • 51,617
  • 12
  • 104
  • 148
  • Thanks for answering. Does read-only permission on a directory, prohibit the ability to branch ? If not, is it not a possibility that some dev might just branch and get full access to the source tree ? – bdutta74 Oct 19 '12 at 18:56
  • A branch is a copy, which only requires read access. And those permissions will not follow the copy, so yes. – alroc Oct 20 '12 at 11:10
  • @icarus74 - no, as they already have full (read-only) access to the source tree. If you want to prevent this you must make some files non-readable. Think of it like this: can they make a zip of the source tree? then they've just "branched" it using a different method. If you give someone read access, they can read all the files, what they cannot do is commit to your source tree so you know its safe. If they branch and commit to that, good for them - your trunk is still untouched, and you can ignore their changes if you like. – gbjbaanb Oct 20 '12 at 12:31
3

You could do this by doing the following:

  1. Move the source files with non-critical functionality to another location in the repository - I'd suggest at a folder level the same as the trunk.
  2. Set up the permissions for the consultants to have read-only access to the existing repository and read / write access to the new directory created in step 1
  3. Add an SVN:Externals for the files you moved in step 1. As from SVN 1.6 you can have individual file externals

Make sure you give your consultants read-only access to the trunk and read-write access to the new directory

Step 3 is the tricky bit so I'll attempt to explain further. Say your original repository has a file structure like this

/trunk
  /lib 
    - Non Critical File 1.txt
    - Non Critical File 2.txt
    - Other files.h

After you have completed step 3 your repository would look something like this:

/trunk 
  /lib
    - SVN: External to Non Critical File 1.txt 
    - SVN: External to Non Critical File 2.txt 
    - Other files.h
/NewDirectory
  - Non Critical File 1.txt
  - Non Critical File 2.txt

Do this for each of the non-critical files.

This will allow your consultants to only view the files in the existing repository, but only update the files in the newly created directory

To set up SVN:Externals see this stack overflow post

Community
  • 1
  • 1
GrandPaPete
  • 127
  • 6