Importing a simple project created in Eclipse into Subversion
How to import a simple project created in Eclipse in Subversion
Directory Layout
In the example below our subversion repository URL would look like this:
/usr/local/svn/repos
Some Definitions
- trunk
- The "mainline" of your project
- branches
- These are the versions of your project
- tags
- Special markers for your project
Planning your Repositories Structure
Before you start filling up your subversion repository you want to decide on a structure for your project.
Here I am using a major organizational structure meaning that the project (in this example called agile will be the root svn directory of the project. Below agile we will have our trunk, branches and tags
Example of our proposed project layout
/usr/local/svn/repos/agile /usr/local/svn/repos/agile/trunk /usr/local/svn/repos/agile/branches /usr/local/svn/repos/agile/tags
Creating our project structure
Creating our project and organizational structure
subversion allows you to use many protocols for executing commands. Here I demonstrate using the file:/// and the https:// protocols (either one works fine, most people will want to start with the file:// protocol which requires no further configuration.
Using the file:/// protocol
(if you are using https, you will want to skip down to the https section!)
svn mkdir file:///usr/local/svn/repos/agile -m "create 'agile' project organization structure"
Example output from a succesful operation:
Committed revision 1.
Our directory listing before creating the organizational structure in the next step
svn list file:///usr/local/svn/repos/agile
Creating svn subdirectories for our project
(using a single multiple line command)
svn mkdir \ file:///usr/local/svn/repos/agile/trunk \ file:///usr/local/svn/repos/agile/branches \ file:///usr/local/svn/repos/agile/tags \ -m "create major organizational structure for the 'agile' project"
Output:
Committed revision 2.
Check our work
svn list file:///usr/local/svn/repos/agile
Example output:
branches/ tags/ trunk/
Using https
(If you used the file:/// protocol, you have already done this work and can skip to the next section.)
Some Helpful Variables
You will want to change these to reflect your setup. In my case I am local to my svn server so I am using "localhost" as the server name. In a production system you would want to be using the Fully Qualified Domain Name of your server (or better yet an alias), usually something like www.mysvnserver.com or ubuntu-workstation...
SERVER_NAME=localhost PROJECT_NAME=agile
# projects main svn directory
svn mkdir https://${SERVER_NAME}/svn/${PROJECT_NAME} -m "Creating ${PROJECT_NAME}"
# projects organizational structure
svn mkdir https://${SERVER_NAME}/svn/${PROJECT_NAME}/trunk -m "trunk"
svn mkdir https://${SERVER_NAME}/svn/${PROJECT_NAME}/branches -m "branches"
svn mkdir https://${SERVER_NAME}/svn/${PROJECT_NAME}/tags -m "tags"
Check our work
svn list https://${SERVER_NAME}/svn/${PROJECT_NAME}
Example output:
branches/ tags/ trunk/
Importing the project
Next I am going to import the project called agile I created earlier in Eclipse into my new svn project space.
Before I get started will change directories to my Eclipse workspace.
For Ubuntu
cd ${HOME}/workspace
In OS X
cd /Users/yourosxuseridehere/Documents/workspace
Import the Project
using file://
svn import agile/ file:///usr/local/svn/repos/agile/trunk -m "Initial import of the 'agile' trunk"
Example output:
Adding agile/.project Adding agile/src Adding agile/src/examples Adding agile/src/examples/__init__.py Adding agile/src/examples/greetings Adding agile/src/examples/greetings/__init__.py Adding agile/src/examples/greetings/standard.py Adding agile/.pydevproject
Checking our import
svn list file:///usr/local/svn/repos/agile/trunk
Output:
.project .pydevproject src/
You project is now imported into subversion!

