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]:
    myrepousr=myrepopwd
  3. Edit the svnserve.conf and add the line
    anon-access=none
  4. Uncomment the line
    passwd-db=passwd

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
Share

Leave a Reply

Your email address will not be published. Required fields are marked *