Build version control environment with Subversion

Source: Internet
Author: User
Tags svn update tortoisesvn
A First, let's start with Subversion.

The original intention of the Subversion project was to replace CVS, the most popular version control software in the open source community, with many enhancements based on CVS and a better solution to some of the deficiencies of the CVS system, which mainly include the following:

1. Versioning of metadata such as catalogs, files, and name changes

Unlike CVS, which only cares about the contents of a file and whether a file exists, all files and directories are versioned, such as renaming, copying, and so on;

2. The commit operation is a real atomic operation

In Subversion, the commit operation is indivisible and the revision number is based on each commit operation rather than the file. The submit log is attached to each revision, rather than being stored as redundant as CVS;

3. Support based on WEBDAV/DELTAV protocol available via the Apache server

This feature enables Subversion to use the Apache Web server to make the repository more flexible to share on the web, making it much better at interoperability than CVS;

4. Can run independently

When you don't want to use Apache 2.x, you can also use Subversion, which can be run independently as a daemon or as a service under Windows;

5. Branch (branching) and label (Tagging) operations are lightweight;

6. Client server-side tiered library structure design;

7. The repository can be stored using a database (BERKELEYDB) or a file in a specific format;

8. More efficient processing of binary files.

Two Installation of Subversion version control environment under Windows system

The easiest way to install under Windows is to download the installer, and you can download the latest binary compression version svn-win32-1.2.3.zip at the address below: http://subversion.tigris.org/servlets /projectdocumentlist?folderid=91 the file into a directory, assuming it is d:subversion.

Next, create a new repository directory for your project, such as: D:repositoryproject1, and execute the following command to initialize the project directory: d:subversionbin> svnadmin create D: Repositoryproject1

Subversion will generate a lot of subdirectories and files in the D:repositoryproject1 directory, then we need to set the user information for the project and the basic information of the project, open the d:repositoryproject1confpasswd file, Remove the comments for [users] and add the user as follows: ### This file is a example password file for Svnserve.

### its format is similar to that of svnserve.conf. As shown in the
### example below it contains one section labelled [Users].
### the name and password for each user follow.
[Users]
admin = admin1234
Liudong = liudong123

Subversion uses the password of the plaintext store user, which should be regarded as one of its deficiencies.

Next Open confsvnserve.conf Modify the following

[General]
Anon-access = Read
auth-access = Write
Password-db = passwd
Realm = Project1

After these basic settings can be started subversion, of course, the best way is to let subversion as a service to run, we can through a third-party tool svnservice let Subversion as Windows services to run the way.

Download Svnservice.zip to http://dark.clansoft.dk/~mbn/svnservice/and unzip it to the {Subversion}bin directory, running svnservice-install-d-R d: Repositoryproject1, the results of the execution Show: Svnservice installed. At this point you can see the service called Svnservice in the service console, start it, and if you do not want to start subversion in the service way, you can run svnserve-d to start subversion.

To uninstall the Svnservice service, you only need to run svnservice-remove.

At this point, Subversion has been installed successfully, and we will explain in the next section how to operate the repository through a variety of clients.

Three Subversion of the use of various clients

A good version of the software is not only the server side to provide strong enough functionality, and there are not enough friendly client is also very important.

Subversion itself provides a command-line-based tool SVN, and basically all operations can be done through this tool, but the user interface is not very friendly. However, we can use this tool first to verify that the Subversion service we have previously installed is working properly. Let's start by importing a project and simply modify, submit, and re-export the project to some of its files, and experience subversion first through these basic operations. (For ease of operation you'd better add the {Subversion}bin directory to the system's Path environment variable)

1. Import Project

Go to the directory where your project is located and execute the following command to submit the entire project

SVN import. Svn://localhost/project1-m "Initial import"--username Liudong--password liudong123

where [.] Represents the current directory, you can also specify the absolute path of the project.

2. Check out items

To verify the project we just imported, we go to a new directory and execute

SVN checkout svn://localhost/project1--username Liudong-password liudong123

You can generate a Project1 project directory in the current directory, and the contents of the directory are all the files we just submitted.

3. Submit the modified file

Modify any of the files in the project and use the commands to submit the changes:

SVN commit readme.txt-m "modified"--username Liudong-password liudong123

4. Get the latest version

When other members of the project team modify and submit a file, you can obtain the latest version of the file by using the following command:

SVN update-r head ReadMe.txt--username liudong-password liudong123

The top four are the most basic operations in the version control environment, but you must be in trouble with this operating environment, and for friends who are developing with the eclipse environment, next we'll introduce an Eclipse plug-in subclipse, This plugin provides operational support for subversion services. You can download the plug-in's compression pack for local updates or remote installation via Eclipse Update, and the Remote installation URL is http://subclipse.tigris.org/update, and I'm sure you'll be on eclipse Update is already at your fingertips, and this is no longer verbose.

Check the plugin has not been installed successfully, open the menu Windows->preferences->team check whether there are SVN node, click SVN can see the plugin's setup interface as shown in the following image:

Leave the default setting, and then we'll import a project into the Subversion server via the plugin, right-click the project name->team->share ... Open the Project Sharing dialog box, which has two choices, one is the built-in support for CVS in Eclipse, and the other is the SVN we just installed. Select SVN to enter the server Setup interface, and enter the image below

Need to fill in the URL of the server and user name and password, the server URL does not need to fill out the project name, click the Next button to enter the project name settings

Here you can see that subclipse automatically adds the name of the item to the URL. Clicking the end button will appear in the following image of the Submit dialog box

Select the file you want to submit or the directory Click OK button to complete the project import. Many of the following operations are similar to CVS, but are much more powerful than CVS, which opens the team's contextual menu as follows:

With this menu, we can see that CVS has all the features on it, and it also includes the ability to lock and unlock files, as well as the ability to set files, and to view the properties of a file through the SVN properties view

Unlike CVS, the SVN plugin displays a small asterisk icon when the file is modified. Similarly, when you don't want to add a file to the repository, you can add it to svn:ignore like CVS. Subclipse Plug-ins There are many other features here are not introduced, we can use in the process to explore.

The above is for people who use the Eclipse development environment, but some of the other members of the project group, such as Web designers, are using subversion with ease. So next we introduce a client tool TORTOISESVN (http://tortoisesvn.tigris.org/) integrated in the Windows shell, which can also be very simple to do with the repository. TORTOISESVN installation is very simple, run the installer directly, install it by default, and reboot the system after installation.

If there is no accident, just right-click a file to see the context menu one more menu item is TORTOISESVN, if the folder will have another item is SVN Checkout .... Before using, you can make some settings according to your liking, right click on any file select Tortoisesvn->settings to open the Settings dialog box as follows: TortoiseSVN

A useful tool for TORTOISESVN is the repository browser, where you can right-click on the desktop to select Tortoisesvn->repo-browser to open the Repository browser as shown in the following illustration:

With this browser you can browse all the items in the repository and the information for each file in the project. But how to do some day-to-day operations, such as submission, update, and so on.

First we look at how to check out (CheckOut) an existing item from the repository, right-click in the margin and choose SVN CheckOut ... Menu items

Enter the folder where the project is stored and the project's corresponding SVN URL address as shown above, click the OK button TORTOISESVN will display detailed progress information

Go to the folder where the project is stored and see that all the files for the entire project have been checked out, and that the icon has been replaced with the TortoiseSVN icon, as shown in the following illustration:

At this time you can modify the file at will, and then right click on the modified file to submit or update the operation.

The three different subversion clients described above have been able to meet the requirements of most users, while the three can complement each other. Subversion can also be combined with the Apache HTTP server to provide a service based on the WebDAV protocol, which is far more shared than CVS, and interested readers can read Subversion's documents for configuration.

For users who are using CVS, a tool called CVS2SVN can also be used to migrate an existing project into subversion, which can be downloaded in http://cvs2svn.tigris.org/.

About the author

Liu Dong, has been using J2EE/J2ME to engage in mobile business development. Now can contact me through the Java Free People website, the URL is: http://www.javayou.com, in addition my mail address is javayou@gmail.com.

Go from: http://www.techrss.cn/html/2008/10-30/161003.htm

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.