Introduction to Subversion via CentOS Command Line: Difference between revisions

From Acenet Knowledgebase
Jump to navigation Jump to search
test
 
No edit summary
Line 1: Line 1:
<html> <strong>What is Subversion?</strong><br /><br />Subversion is a software version control system, allowing users to keep track of when and why changes occur to open source code. Code is stored in a directory structure called a repository. Changes to files and directories within a subversion repository are commited, resulting in a new version of the software which can be easily checked out by other users implementing that repository.<br /><br />Subversion is available in many linux distros (as well as Windows). This article focuses on using subversion via SSH in CentOS.<br /><br />The subversion homepage is:  
==What is Subversion?==
<a href="http://subversion.apache.org/">http://subversion.apache.org/</a><br /><br />This basic tutorial covers installing subversion, creating a repository, importing projects, checking out your repository, and committing revisions to the repository.<br /><br /><span style="text-decoration: underline;"><strong>Installation</strong></span>
 
Here is the command you will want to run via SSH when logged in as root:<strong><br /></strong>  
Subversion is a software version control system, allowing users to keep track of when and why changes occur to open source code. Code is stored in a directory structure called a repository. Changes to files and directories within a subversion repository are committed, resulting in a new version of the software which can be easily checked out by other users implementing that repository.
<div class="code_style">yum install subversion</div>
 
<span style="text-decoration: underline;"><strong>Creating a Repository</strong></span><br /><br />- Change your current directory to where you want to create your repository. In this example, we'll use /home/repo/ as our working repository directory. This is the directory that subversion will use to store information about your projects.  
Subversion is available in many Linux distros (as well as Windows). This article focuses on using subversion via SSH in CentOS.
- The 'svnadmin' command is used to create the repository. In the following example, 'mysvn' is the name of our repository. You can name your repository whatever you would like.  
 
<div class="code_style">cd /home/repo<br />svnadmin create mysvn</div>
The subversion homepage is:  
<span style="text-decoration: underline;"><strong>Importing Projects</strong></span><br /><br />- Projects are imported and managed within the repository created above.  
 
- Importing a project requires a directory within your repository. Let's make that directory now using the 'svn' command. Note - you should replace the path in the below command with the actual path to your repository and new project name.  
http://subversion.apache.org/
<div class="code_style">svn mkdir file:///home/repo/mysvn/myproject</div>
 
- Subversion will open your Operating System's default text editor, where you will log an explanation of what you are doing, what changes you're making, etc. After completing your log entry, save and exit the editor.<br /><em>Note: /home/repo/mysvn/myproject has not yet been created in your Operating System's directory structure. It is only available in your repository.</em><br /><br />- Import project files using the svn import command:  
This basic tutorial covers installing subversion, creating a repository, importing projects, checking out your repository, and committing revisions to the repository.
<div class="code_style">svn import file:///home/repo/mysvn/myproject</div>
 
- Files in your project are imported into the 'myproject' directory within your repository.  
==Installation==
<span style="text-decoration: underline;"><strong>Checkout and Commit</strong></span><br /><br />- To make revisions to your project files, a working copy of your project must be checked out of the repository. For this, we use 'svn checkout':  
 
<div class="code_style">svn checkout file:///home/repo/mysvn</div>
Here is the command you will want to run via SSH when logged in as root:<strong><br /></strong>  
- The repository and all revisions are now checked out. A new directory containing your project's files is now available in your OS directory structure. To view them, simply change to your project's directory:  
 
<div class="code_style">cd /home/repo/mysvn/myproject</div>
<syntaxhighlight lang="bash">yum install subversion</syntaxhighlight>
- You can now make revisions to your project's files. When you are finished, and you're ready to store your new revision into your repositoiry, run 'svn commit' from your project's directory:  
 
<div class="code_style">svn commit</div>
==Creating a Repository==
<br />- Subversion will again open your Operating System's default text editor where an explanation of your revision are logged. Save and exit the text editor when you are finished.<br /><br />- Your revision is now committed to your repository. Other users can now implement the revisions that you made to your software.</html> [[Category:CentOS 5]]
 
Change your current directory to where you want to create your repository. In this example, we'll use /home/repo/ as our working repository directory. This is the directory that subversion will use to store information about your projects.
 
The 'svnadmin' command is used to create the repository. In the following example, 'mysvn' is the name of our repository. You can name your repository whatever you would like.  
 
<syntaxhighlight lang="bash">
cd /home/repo
svnadmin create mysvn
</syntaxhighlight>
 
==Importing Projects==
 
Projects are imported and managed within the repository created above.  
 
Importing a project requires a directory within your repository. Let's make that directory now using the 'svn' command. You should replace the path in the below command with the actual path to your repository and new project name.
 
<syntaxhighlight lang="bash">
svn mkdir file:///home/repo/mysvn/myproject
</syntaxhighlight>
 
Subversion will open your Operating System's default text editor, where you will log an explanation of what you are doing, what changes you're making, etc. After completing your log entry, save and exit the editor.
 
{{note|/home/repo/mysvn/myproject has not yet been created in your Operating System's directory structure. It is only available in your repository.}}
 
Import project files using the svn import command:  
 
<syntaxhighlight lang="bash">
svn import file:///home/repo/mysvn/myproject
</syntaxhighlight>
 
Files in your project are imported into the 'myproject' directory within your repository.  
 
==Checkout and Commit==
 
To make revisions to your project files, a working copy of your project must be checked out of the repository. For this, we use 'svn checkout':
 
<syntaxhighlight lang="bash">
svn checkout file:///home/repo/mysvn
</syntaxhighlight>
 
The repository and all revisions are now checked out. A new directory containing your project's files is now available in your OS directory structure. To view them, simply change to your project's directory:  
 
<syntaxhighlight lang="bash">
cd /home/repo/mysvn/myproject
</syntaxhighlight>
 
You can now make revisions to your project's files. When you are finished, and you're ready to store your new revision into your repositoiry, run 'svn commit' from your project's directory:  
 
<syntaxhighlight lang="bash">
svn commit
</syntaxhighlight>
 
Subversion will again open your Operating System's default text editor where an explanation of your revision are logged. Save and exit the text editor when you are finished.  
 
Your revision is now committed to your repository. Other users can now implement the revisions that you made to your software.  
 
[[Category:CentOS 5]]

Revision as of 12:19, 9 October 2012

What is Subversion?

Subversion is a software version control system, allowing users to keep track of when and why changes occur to open source code. Code is stored in a directory structure called a repository. Changes to files and directories within a subversion repository are committed, resulting in a new version of the software which can be easily checked out by other users implementing that repository.

Subversion is available in many Linux distros (as well as Windows). This article focuses on using subversion via SSH in CentOS.

The subversion homepage is:

http://subversion.apache.org/

This basic tutorial covers installing subversion, creating a repository, importing projects, checking out your repository, and committing revisions to the repository.

Installation

Here is the command you will want to run via SSH when logged in as root:

<syntaxhighlight lang="bash">yum install subversion</syntaxhighlight>

Creating a Repository

Change your current directory to where you want to create your repository. In this example, we'll use /home/repo/ as our working repository directory. This is the directory that subversion will use to store information about your projects.

The 'svnadmin' command is used to create the repository. In the following example, 'mysvn' is the name of our repository. You can name your repository whatever you would like.

<syntaxhighlight lang="bash"> cd /home/repo svnadmin create mysvn </syntaxhighlight>

Importing Projects

Projects are imported and managed within the repository created above.

Importing a project requires a directory within your repository. Let's make that directory now using the 'svn' command. You should replace the path in the below command with the actual path to your repository and new project name.

<syntaxhighlight lang="bash"> svn mkdir file:///home/repo/mysvn/myproject </syntaxhighlight>

Subversion will open your Operating System's default text editor, where you will log an explanation of what you are doing, what changes you're making, etc. After completing your log entry, save and exit the editor.

/home/repo/mysvn/myproject has not yet been created in your Operating System's directory structure. It is only available in your repository.

Import project files using the svn import command:

<syntaxhighlight lang="bash"> svn import file:///home/repo/mysvn/myproject </syntaxhighlight>

Files in your project are imported into the 'myproject' directory within your repository.

Checkout and Commit

To make revisions to your project files, a working copy of your project must be checked out of the repository. For this, we use 'svn checkout':

<syntaxhighlight lang="bash"> svn checkout file:///home/repo/mysvn </syntaxhighlight>

The repository and all revisions are now checked out. A new directory containing your project's files is now available in your OS directory structure. To view them, simply change to your project's directory:

<syntaxhighlight lang="bash"> cd /home/repo/mysvn/myproject </syntaxhighlight>

You can now make revisions to your project's files. When you are finished, and you're ready to store your new revision into your repositoiry, run 'svn commit' from your project's directory:

<syntaxhighlight lang="bash"> svn commit </syntaxhighlight>

Subversion will again open your Operating System's default text editor where an explanation of your revision are logged. Save and exit the text editor when you are finished.

Your revision is now committed to your repository. Other users can now implement the revisions that you made to your software.