2014/03/05

Create SVN Repository from Existing Project

Re-posting from :http://masstransmit.com/garage_blog/create-svn-existing-project/
Initially creating a repository in SVN is a little clunky in that you start your project, then you create the repository from that project, but then you have to checkout the repository over that initial project so you can check in future updates. Also, if your project directory name differs from the repository directory name, the initial checkout will create a new directory for the project. Using tar and find can help you through this initial stage.
First, to create an SVN directory, you execute:
svnadmin create /path/to/repository/projectname
Secondly, given your project directory, project_dev, you import the project using:
svn import /path/to/project_dev file:///path/to/repository/projectname -m "first import"
Third, you have to create a working copy of the repository. This is where you checkout the project and it includes all the .svn directories:
svn co /path/to/repository/projectname
This will create the directory projectname containing the project. You now haveproject_dev that is not under SVN control and projectname which is. 

In some cases,project_dev may be under a webserver or other sorts of configuration which you do not want to disrupt.
The best thing to do is just pull out all the .svn files from projectname using tar and find:
cd /path/to/projectname
tar -vcf svn.tar `find . -name .svn`
or
find ./project_dev
 -name .svn | xargs tar -cvf svn.tar
The will tar all the .svn directories. Now move svn.tar to project_dev and unpack:
mv svn.tar /path/to/project_dev
cd /path/to/project_dev
tar -xvf svn.tar
The .svn directories then unpack into the project_dev directory structure. From here,project_dev is under SVN control. You may delete projectname (not the repository, of course).

Nessun commento: