Monday, September 22, 2008

creating new svn repos and adding new project

Start by using svnadmin to create the repository somwhere that make sense. Most times if your just putting it on your workstation you should just put it in your home directory. If you want other users to have access to the repository put it somewhere globally accessible like /usr/local/subversion/repos

$ svnadmin create /usr/local/subversion/repos

then once the repository has been created you will want to add your current project to it.

go into the directory that holds the files you want to put into the repository.

$ cd /path/to/project/directory

then import the files into the repository making sure to use a similar path structure like below including the projectname and trunk and possibly a subproject name if your project has multiple subprojects. If not you can omit that part.

$ svn import ./ file:///usr/local/subversion/repos/projectname/trunk/subprojectname -m 'Initial import of projectname subprojectname'

now that that has been done you still need to get a working copy of the files on your local machine so delete all the files in the current directory.

$ svn checkout file:///usr/local/subversion/repos/projectname/trunk/subprojectname -m 'Initial import of projectname subprojectname'

now you will have a copy of all of the files you imported recreated within the folder you just deleted them from but this time their versions will be tracked and you can do things like:

svn status (to check what you have changed in your working copy)

svn update (to get all new files from the repository)

svn add filename (to add new files into the repository)

svn commit (to update the repository with all the changes from your working copy)

No comments: