User Tools

Site Tools



This shows you the differences between two versions of the page.

Link to this comparison view

project_management:subversion [2010/06/09 15:12] (current) created
Line 1: Line 1:
 +====== Subversion ======
 +Subversion (SVN) uses a centralized model to manage software projects. ​ Collaborators check the source code out from the repository to their local development environments,​ make changes, then check code back in.
 +The repository can be on the local machine or a remote server, as SVN supports several protocols (%%svn://​%%,​ %%http://%% using Apache'​s mod_dav_svn module, %%file://​%%,​ etc)..
 +===== Install =====
 +<​code>​$ sudo aptitude install subversion</​code>​
 +Configure Apache:
 +===== Create a New Project =====
 +==== On The Server ====
 +Create the project skeleton (the name isn't important, it is only a folder in the file system):
 +<​code>​$ sudo mkdir /​tmp/​myproject
 +$ sudo mkdir /​tmp/​myproject/​{branches,​tags,​trunk}</​code>​
 +Create the SVN repository, :
 +<​code>​$ sudo mkdir /​mnt/​repositories/​myproject
 +$ sudo svnadmin create /​mnt/​repositories/​myproject</​code>​
 +Import the initial project skeleton:
 +<​code>​$ svn import /​tmp/​myproject/​ file:///​mnt/​repositories/​myproject/​ -m "​Initial import of project skeleton"</​code>​
 +Clean up temp files and repository permissions. The repository needs ''​www-data''​ permissions because Apache will be serving our repository for us:
 +<​code>​$ sudo rm -rf /​tmp/​myproject
 +$ sudo find /​mnt/​repositories/​myproject/​ -type f -exec chmod 660 {} \;
 +$ sudo find /​mnt/​repositories/​myproject/​ -type d -exec chmod 2770 {} \;
 +$ sudo chown -R root.www-data /​mnt/​repositories/​myproject/</​code>​
 +Tell Apache to use ''/​svn/​myproject''​ URLs with the dav_svn module, ''/​etc/​apache2/​conf.d/​svn.conf'':​
 +<​file><​Location /​svn/​myproject>​
 +    DAV svn 
 +    SVNPath /​mnt/​repositories/​myproject
 +    AuthzSVNAccessFile /​mnt/​repositories/​authz_svn_access
 +    AuthName "​Microsoft Active Directory Authentication"​
 +    AuthType Basic
 +    PerlAuthenHandler Apache2::​AuthenMSAD
 +    PerlSetVar MSADDomain
 +    PerlSetVar MSADServer
 +    # require any valid AD user to access the repo via Apache,
 +    # then use fine-grained controls in the AuthzSVNAccessFile
 +    # above. See: http://​​nightly/​en/​svn.serverconfig.pathbasedauthz.html#​id646000
 +    require valid-user
 +    # Or, use specific (but dumb) controls here in the Apache
 +    # config file instead of the AuthzSVNAccessFile above.
 +    #require user aorth akihara
 +Gracefully restart Apache to enable the changes:
 +<​code>​$ sudo apache2ctl graceful</​code>​
 +==== On The Client ====
 +Check out the development branch ("​trunk"​) to a local folder ("​myproject"​):​
 +<​code>​$ cd code/
 +$ svn co --username=aorth https://​​svn/​beca/​trunk myproject</​code>​
 +Import your existing code base ("​mycode"​) into the project:
 +<​code>​$ cd myproject
 +$ cp -R /​home/​aorth/​mycode/​* .
 +$ svn add *
 +$ svn commit -m "​Initial import of codebase"</​code>​
 +===== Ignoring Files and Folders =====
 +Sometimes you need to ignore certain files/​folders (logs, temp files, etc) so that SVN doesn'​t try to commit those changes when it finds new files. ​ For example: ignore everything in our project'​s ''​tmp''​ folder:
 +<​code>​$ svn propedit svn:ignore tmp/</​code>​
 +And then place a single "​*"​ in the text editor to ignore everything in the tmp folder. ​ Otherwise, you can do something like "​*.log"​ to ignore all log files.
 +===== Tagging Releases =====
 +==== From trunk ====
 +<​code>​$ cd myproject/
 +$ svn copy . http://​​svn/​myproject/​tags/​0.2</​code>​
 +Switch a working copy to a certain release:
 +<​code>​$ svn sw http://​​svn/​myproject/​tags/​0.2</​code>​
 +===== Links =====
 +  * http://​​wiki/​TracSubversion
project_management/subversion.txt · Last modified: 2010/06/09 15:12 by