You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Background

Projects within the IEPM group are version controlled using SubVersioN.

A nice online manual of SVN usage and theory is located here.

SVN Repository Creation

An SVN Repository has been created at /afs/slac.stanford.edu/g/scs/net/netmon/repo/svn. The command to create this was:

$ svnadmin create /afs/slac.stanford.edu/g/scs/net/netmon/repo/svn --fs-type fsfs

Note that we are using fs-type fsfs due to the fact that we are housing the repo on an AFS share.

SVN Project Creation

New projects can be created by IEPM members (with sufficient AFS permissions). Given an existing project with files to be imported, one would run the command:

$ cd <project-path>
$ svn import . file:///afs/slac.stanford.edu/g/scs/net/netmon/repo/svn/<project-name>/trunk

This will recusively add all files within <project-path> into the SVN repositry; whereby it will be located at <project-name>.

The use of /trunk at the end of the path is arbitary; however, it is recommended good practise to facilitate the branching of projects.

Once a project has been initially imported into the SVN database, it is necessary to start working on a 'fresh' version (as the files in the initial import do not 'know' about the SVN). This is achieved with a SVN checkout.

SVN Checkout

In order to work on SVN projects, it is necessary to 'checkout' the project files. Given a project, you are expected to work on edits on a local copy from which editing and testing is to occur before the changes are 'checked in' back into the SVN repository.

You can check-out a project via:

$ cd /tmp/
$ svn co  file:///afs/slac.stanford.edu/g/scs/net/netmon/repo/svn/<project-name> my_project

This will retrieve the latest versions of the files contained within the SVN project <project_name> and place it into the directory /tmp/my_project. Note that this location is arbitary.

Checking-In Edits

Once a SVN project has been checked out, files can be edited. Code should be tested to work on the local copy before committing the changes back into the SVN repository. The processes of committing the edits is called 'checking in' your files.

For example, should a file in your project have been edited, you can commit the changes back by:

$ cd /tmp/my_project
$ # edit, say, file /tmp/my_project/test
$ svn commmit

Unless the options --message or -m} are supplied, the editor specified in your {{EDITOR environment will open to prompt for some text input. This text will form the description of your edits and will be stored in the SVN log for the file(s). Please put something meaningful such as 'Fixed bug which caused text to display incorrectly' rather than 'Fixed bug'.

The processing of checking in edits will also scan for all files in the project (and recursively do so). If you wish to only commit changes to one or a select number of files, use the --file or {-F} options.

Adding Files to the Project

In order to add additional files after the initial import into a project, you must manually add files using the command:

$ cd /tmp/my_project
$ touch new_file.pl
$ svn add new_file.pl
$ svn commit

Once you have ran the command, you must {{commit} the action in order to place the newly created file into the repository (again it will prompt for some text describing the changes).

  • No labels