TCM
UoC crest

TCM's Repository: a Shared Example

This example concentrates on how to create a repository with full access by multiple users. In this case, just two users, mjr19, who creates the repository, and mjr, who is also given access to it. The svn commands merely follow UNIX file permissions, and do not attempt to impose additional restrictions.

First mjr19 needs to create a UNIX group for all who are to have write access to the repository. Usually this would require negotiation with the system administrator. On cvs, negotation has already resulted in every user being able to create up to 26 groups, named by appending a single lower-case letter to his user-id.

cvs-chroot:~$ group
Usage: group -a group user   (add user to group)
       group -c group        (create a new group)
       group -d group user   (delete user from group)
       group -l group        (list users in group)
       group -x group        (expunge an empty group)
cvs-chroot:~$ group -c mjr19c
cvs-chroot:~$ group -a mjr19c mjr
cvs-chroot:~$ exit

Logging out at this point is important! For only when you log in does your shell acquire its group membership(s), so, until mjr19 next logs in, he is not a member of mjr19c, and so will be unable to change files to that group. One can now create the repository, and change the group ownership of the files therein:

cvs-chroot:~$ svnadmin create c2x
cvs-chroot:~$ chgrp -R mjr19c c2x
cvs-chroot:~$ chmod g+w c2x/db/rep-cache.db

(The final chmod command is to deal with an awkward bug in the version of svn (or arguable sqlite) which is currently used on the server.)

Now we can perform the initial upload:

m1:/scratch/mjr19/check2xsf_1.02RC3aS$ svn import svn+ssh://cvs.tcm.phy.cam.ac.uk/home/mjr19/c2x/check2xsf_S/ -m 'Initial import'
Adding         super.c
Adding         xyz_write.c
Adding         periodic_table.c
Adding         bravais_p.c
[...]

Remember that the contents of the current directory are not now a working copy. One has to checkout from the repository for that. Note also that everything has been imported one subdirectory below the root of the c2x repostiory. This gives more flexibility for creating branches later, which is likely to happen with multi-user projects. Although in theory one could place multiple completely distinct projects in different subdirectories of a single repository, in practice, particularly in the case of TCM's set-up with an attached webserver which does not fully understand that different subdirectories in a single repository might have different access permissions, I would not recommend it.

Now mjr, who has some examples which are associated with this project, can upload them. He chooses a different subdirectory under the same repository.

pc23:/scratch/mjr/examples$ svn import svn+ssh://cvs.tcm.phy.cam.ac.uk/home/mjr19/c2x/examples/ -m 'Initial import of examples'
Adding         real
Adding         real/SiC_2H.cell
Adding         real/SiC_cubic6.cell
Adding         trivial
Adding         trivial/CP.cell
Adding         trivial/CF.cell

Committed revision 2.

Of course, mjr, who is aware that some work needs to be done on mjr19's files, can do that too:

pc23:/scratch/fix$ svn checkout svn+ssh://cvs.tcm.phy.cam.ac.uk/home/mjr19/c2x/check2xsf_S
pc23:/scratch/fix$ cd check2xsf_S
pc23:/scratch/fix/check2xsf_S$ vi TODO README.FIRST
pc23:/scratch/fix/check2xsf_S$ svn status
?       README.FIRST
M       TODO
pc23:/scratch/fix/check2xsf_S$ svn add README.FIRST 
A         README.FIRST
pc23:/scratch/fix/check2xsf_S$ svn commit -m 'Trivial changes to readmes'
Adding         README.FIRST
Sending        TODO
Transmitting file data ..
Committed revision 3.

(As ever, new files added must first be marked with svn add before the commit command will add them. This avoids svn suddenly swallowing large numbers of .o, .mod or .dvi files unexpectedly! Note that mjr choose not to checkout the examples directory. Had he left off the final check2xsf_S he would have received working copies of both the code and examples.)