Once the setup of the application is done, starting a source versioning (or version control) process is recommended. Source versioning keeps track of all modifications in the code, gives access to previous releases, facilitates patching, and allows for efficient team work. Symfony natively supports CVS, although Subversion (http://subversion.tigris.org/) is recommended. The following examples show the commands for Subversion, and assume that you already have a Subversion server installed and that you wish to create a new repository for your project. For Windows users, a recommended Subversion client is TortoiseSVN (http://tortoisesvn.tigris.org/). For more information about source versioning and the commands used here, consult the Subversion documentation.
The following example assumes that $SVNREP_DIR
is defined as an environment variable. If you don't have it defined, you will need to substitute the actual location of the repository in place of $SVNREP_DIR
.
So let's create the new repository for the myproject
project:
> svnadmin create $SVNREP_DIR/myproject
Then the base structure (layout) of the repository is created with the trunk
, tags
, and branches
directories with this pretty long command:
> svn mkdir -m "layout creation" file:///$SVNREP_DIR/myproject/trunk file:///$SVNREP_DIR/myproject/tags file:///$SVNREP_DIR/myproject/branches
This will be your first revision. Now you need to import the files of the project except the cache and log temporary files:
> cd ~/myproject
> rm -rf cache/*
> rm -rf log/*
> svn import -m "initial import" . file:///$SVNREP_DIR/myproject/trunk
Check the committed files by typing the following:
> svn ls file:///$SVNREP_DIR/myproject/trunk/
That seems good. Now the SVN repository has the reference version (and the history) of all your project files. This means that the files of the actual ~/myproject/
directory need to refer to the repository. To do that, first rename the myproject/
directory — you will erase it soon if everything works well — and do a checkout of the repository in a new directory:
> cd ~
> mv myproject myproject.origin
> svn co file:///$SVNREP_DIR/myproject/trunk myproject
> ls myproject
That's it. Now you can work on the files located in ~/myproject/
and commit your modifications to the repository. Don't forget to do some cleanup and erase the myproject.origin/
directory, which is now useless.
There is one remaining thing to set up. If you commit your working directory to the repository, you may copy some unwanted files, like the ones located in the cache
and log
directories of your project. So you need to specify an ignore list to SVN for this project. You also need to set full access to the cache/
and log/
directories again:
> cd ~/myproject
> chmod 777 cache
> chmod 777 log
> svn propedit svn:ignore log
> svn propedit svn:ignore cache
The default text editor configured for SVN should launch. If this doesn't happen, make Subversion use your preferred editor by typing this:
> export SVN_EDITOR=<name of editor>
> svn propedit svn:ignore log
> svn propedit svn:ignore cache
Now simply add all files from the subdirectories of myproject/
that SVN should ignore when committing:
*
Save and quit. You're finished.