Category Archives: Subversion

Subversion and commands

This subversion tutorial describes the common subversion commands to maintain your repository.Subversion tutorial and commands

Setup a new repository on your diskstation (see this article for instructions to install Subversion onto your DiskStation):

  1. Goto your DiskStation box with the SVN server and create the repository:
    /opt/bin/svnadmin create myrepo
  2. Edit the passwd file in /volume1/svn/myrepo/conf/passwd; add a line below [users]:
  3. Edit the svnserve.conf and add the line
  4. Uncomment the line

Now to add an existing folder to this new repository execute the command below:
svn import localdir svn://diskstation.local/myrepo

The local directory localdir is now under source control. Add some files to the local directory and execute the status command:

svn status
?       newfile

The files you just added are shown starting with a question mark. You can add the new files to your repository with the add command:

svn add newfile
A      newfile

The file is now added to source control but it is not committed yet; lets do that now with the command commit command:

svn commit

Your default (terminal) editor will open and you are allowed to type a comment for this new revision; go ahead and type your comment (or leave it empty). After you type your comment press Ctrl-X; if you typed a comment pres Y and press enter; otherwise press c.

Subversion responds with the message below; your newfile is added:

Adding newfile
Transmitting file data .
Committed revision 119.

Delete a file from your repository with the delete command:

svn delete newfile
D        newfile

Commit the delete action with the commit command:

svn commit
Deleting newfile

If you ever run into the warning message “Directory ‘current/dir’ is out of date update local files” you have to update your local copy of the repository; execute the command below:

svn update

Add all new files to the SVN repo:

svn status | grep -v "^.[ \t]*\..*" | grep "^?" | awk '{print $2}' | xargs svn add

Create SVN repository on Synology

Howto install SVN on your Synology:

Telnet to your NAS
Repositories has to be owned by svnowner; be sure to execute creation of the repository as svnowner (or chown afterwards):

$>su svnowner

On the synolyg your harddisk is mounten at /volume1; create a directory “svn” here:

cd /volume1
mkdir svn
cd svn

Now create your SVN repository with the svnadmin command (on the synology the svn command is not on the path but can be found at /opt/bin):

/opt/bin/svnadmin create test

If you want to delete a repository you can do this with regular unix commands; there is no “internal” SVN registration.

Now you have to setup the access to this new repository. Change directory to your new repository conf folder:
cd /volume1/svn/test/conf

The svnadmin command has stored some default files here; passwd and svnserve.conf. First edit the passwd file to add your users for this repository. Below the [users] text add your users.

Now edit the svnserve.conf in the same folder. Disable anonymous access to your repository by adding: anon-access = none

To use the password file for authentication of your users you have to uncomment the password-db = passwd line.

That’s all you have to do on your synology. SVN is setup (see link) and the repository is created with appropriate user access..

Now go to your client machine and checkout the new repository:

svn co svn://[your hostname here]/test

Check the status of your local repository copy:

svn status

Add a file to your repository

svn add newfile

And commit the file to the repository

svn commit newfile