Adding/Deleting a Project to Trac and Subversion
Once a working Trac and SVN server is set up, basic tasks such as creating and deleting projects can be done. Project deletion is obviously a rare occurrence; Trac and SVN do not even have a command that performs this task. This page provides instructions on how to achieve these two tasks. Backup/restore operations are detailed elsewhere since these tasks are only performed once the new project pages and repository are in use.
Note: The following instructions assume that your Trac and SVN server is set up as per this page and this page.
Automation (Scripts)
As with the installation procedure, a set of scripts are available that automate these tasks:
- Script to add a project: devserver-createproject.
Usage: Replace "New Project" with the full title of the new project (keep the quotation marks); The script will automatically create an appropriate directory name:
su
<it will prompt for your root (administrator) password>
wget https://hdrlab.org.nz/assets/Articles/TracSVNUse/devserver-createproject
chmod 766 devserver-createproject
./devserver-createproject "New Project"
- Script to delete a project: devserver-deleteproject.
Usage: Replace "unwantedproject" with the full title of the new project:
su
<it will prompt for your root (administrator) password>
wget https://hdrlab.org.nz/assets/Articles/TracSVNUse/devserver-deleteproject
chmod 766 devserver-deleteproject
./devserver-addproject "unwantedproject"
NOTE: The devserver-createproject script was updated 2010/10/09 for changes to the Trac command line introduced in version 0.11. If you have an older version of Trac, either upgrade, or append the following to the end of the trac-admin line: /usr/share/trac/templates
Adding a Project
In the following instructions, replace "newproject" with whatever you wish to call the project:
- Create the Subversion Repository:
su
<it will prompt for your root (administrator) password>
cd /home/svn
su www-data "svnadmin create newproject"
- Create the Trac project pages:
cd /home/trac
trac-admin newproject initenv
- Trac-admin will prompt for certain information. For project name, give the project an appropriate title (e.g., "New Project"). All other items can be left at their defaults except for the trac repository, which should point to the new repository ar /home/svn/newproject,
- Change the permissions for the new project directory:
chown -R www-admin newproject
- Please note that Trac will display an error for SVN repositories that have no revisions (i.e., no source-files have been imported yet). The first revision can be created by performing an initial import. Once this is done, visiting the new Trac page at http:mytracserver.com/projects/newproject (replace mytracserver.com with the URL of your server) should look something like:
Deleting a Project
There are no official commands to remove a project from Trac and SVN. However, deleting the directories containing the project files and repository has the desired effect. In the following instructions, replace "unwantedproject" with whatever you wish to call the project:
- Delete the Trac project directory:
su
<it will prompt for your root (administrator) password>
rm -R/home/trac/unwantedproject
- Delete the SVN repository:
rm -R /home/svn/unwantedproject
- The project is now deleted.
Articles » A (Linux) Server for Software Developers » Setting up and Using a Secure Trac and Subversion Server » Adding/Deleting a Project to Trac and Subversion