SVN restore to the specified version operation

Source: Internet
Author: User
Tags rollback svn version control system tortoisesvn
The purpose of this article

Allow people who have not used version controller software or have not used subversion software to get started as soon as possible.

Subversion uses a lot of tricks, and here's a summary of the minimal usage set, the main basic function that can be used to cope with daily work.

It does not involve the construction and configuration of Subversion server-side. Why to use version control

When multiple people develop the same software together, it involves the sharing of source code and related issues, such as the question of who is responsible for the change of the code at what time.

The benefits of versioning are listed below: A fallback button for all project documents is provided for the team, and the Personal IDE tool can only provide a rollback button for a file, not the same as all project files that fall back to 3:10 P.M. June 12, 2008; Enables multiple developers to work in a controlled manner for the same Code; The version control system saves changes to the document in the past, making it easier to find out who, when, and what changed the document, which supports multiple versions at the same time on the main line of the document (branching and merging of versions is the primary means of versioning, Some development teams are simply the shared code backbone); supports querying the status of project documents at a certain point in time, can be used to study productivity, etc. (for example, which period code submissions are most active for statistical projects, as well as the code submission frequency of each person, etc.), and can also be used for redistribution of previous software distributions (e.g. Previously built version 2.0 of the installation package is missing, you can backtrack to that version through the history of the version controller record, and then rebuild the installation package. Why use Subversion

First, consider the use of free open source and lightweight version controllers.

Second, the use of a more extensive, optional CVS and SVN.

Here you choose SVN, the main consideration is better integration of Apache use, the submission code to support atomic level operations (that is, such as the submission of 3 files, if the network or other reasons, upload 2 files after the interruption, SVN can do the server-side rollback to the state before the submission, and CVS does not do this, Requires manual inspection and recovery). The procedural makeup of subversion

Subversion program, and MySQL is very similar to the C/s structure, has the client and server side. Both the server side and the client are started and executed by command line. This article will only use commands to the client.

Third parties provide a variety of graphical interface client tools, such as the Eclipse Plug-in subclipse,windows graphical interface tool TORTOISESVN. These are referred to in their basic use later. Subversion Resources Subversion official website: Http://subversion.tigris.org/subclipse official website: http://subclipse.tigris.org/ TORTOISESVN Official website: http://tortoisesvn.tigris.org/use Subversion for version control in Chinese version online: http://www.subversion.org.cn/svnbook/ Install Subversion

The installation of subversion and Subclise is temporary because the virtual machine development environment currently available is installed and configured.

TortoiseSVN, you can download the latest version of the Windows installation package on the official website, install it by default, do not need to do other setup, and need to restart the computer after installation. The right mouse button menu in the Explorer sees the entry shown in the following figure, indicating that the installation was successful.

using Subversion

The use of subversion in daily work is only a few commands or operations, not complicated. But some of its internal mechanisms need to be understood gradually. Check out Code

When you first entered a development team, there was already a version control and software project, and the first command you used was often the checkout (checkout) code. or when using and researching open source software, is the first to use this command. The purpose of this command is to download the project's source code to the user locally, with version control information.

For example, execute the following command to obtain the source code for a project:

SVN Co http://easymorse.googlecode.com/svn/trunk/vfs.demo/

This command will build the Vfs.demo directory in the local current directory and download all files in the server directory locally, and a hidden file will be generated. The SVN directory, which is used to record version control information.

TORTOISESVN has a graphical interface to check out operations, but the command line is convenient and quick, we recommend using the command line.

If you use Eclipse and install the Subclipse plug-in, you can import the project through a plug-in.

And then

Select or create a new resource pool location.

Select the project directory in the resource pool.

Then, you can finish (finish).

Initial Import

When to use an initial import, for example, for Java developers to write a project in Eclipse and decide to share the project with the version controller, the initial import operation is required.

The following example shows the steps of the initial import in Subclipse.

The first step is to choose Share project and share your project:

Choose to share items through SVN:

Fill in SVN submitted URL:

This URL requires a Subversion administrator to inform you, as well as a username and password. If you want to practice, Google provides free SVN, you can through: http://code.google.com application project, so there will be similar to my above URL and permissions.

You can then click Finish directly to complete the initial submission. Select next to make custom module names and initial submissions, which are generally not required.

If your SVN server uses the HTTPS protocol, you need to accept a digital certificate and generally choose to accept it permanently.

The user name and password will be required after the entry. We suggest that you save the password, otherwise it will be troublesome.

Then, looking at the item, you will find that there are many question marks on the entry, then you need to choose which directories and files to submit, which needs to be ignored, such as the generated class file.

Select the files or directories you want to ignore, and then switch to the Navigation view to see all the files and directories:

What you see from the Navigation view:

Select the directories and files that you want to ignore and manipulate SVN:

Then submit the entire project. See below for the actions submitted. Update Project

Before submitting a project, you should do an update project operation first. For example, there is a file a.txt, has been submitted to SVN, so that other users may have submitted new changes to A.txt, you have now modified A.txt, ready to submit your changes. The update a.txt is operated first so that if the file is changed on the SVN server, the changes are added to the current local a.txt.

Actions in Subclipse:

Submitting Code

Submitting code, generally cascading the contents of all changes under the current directory.

Delete Code

For code that is no longer in use, it can be deleted directly, such as deleting files through windows, using the Ubuntu RM command, or by using the Eclipse's delete function, and then submitting the project, Subclipse will know which file was deleted. and notify the SVN server of this change. Restore Code

If the code changes, can be more than one file, you can delete the file or new files, but not submitted to the SVN server, you can restore the changes before the appearance.

branching and merging of versions

The branching and merging of versions is a core feature of version control.

For example, software through the version of the branch, assign the project to more than one person to do the division of labor Development, through version merging, the implementation of these Division of labor Code into a new version; or, when modifying code bugs, you can first print a version of the branch, keep the version of the bug, such as the branch version name Pre_fix_bug _2201, here 2201 indicates the code of the bug, and then fix the bug for this branch, then submit the modified content to a new branch version, such as post_fix_bug_2201, and then merge the branch into the code trunk in due course.

Here's how the version branching and merging is used, and here's a quick look at the basics of the SVN version branching merge.

The first is the version branch, which is actually the current version of "copy" to the branch, very similar to Windows, to copy a directory shortcut to another path. This copy, which can be said to be lightweight copy or cheap copy, is not a copy of the version content, but rather an internal reference. This copy is fast and there is no space overhead for the server.

Version of the merger is a difficult point in SVN development, when the version of the merge, the server will try to intelligently merge the different versions of the same file, may bring version conflict, which requires the operator to do manual processing, eliminate version conflict. A reasonable division of labor project should be able to avoid this situation as far as possible by means of management.

The following is the operation of the Subclipse demo version branch. First, the project document should have been all submitted, then, select

Then, fill in the URL, usually under the tags/directory:

Then the default option, Next, and then select the Finish button. There will be an item with the same name under SVN's corresponding path.

Playing the branch, in effect, is to build a lightweight copy of the project.

It's also important to switch from one branch of the version to another, which can help you easily switch between different project versions without having to maintain multiple projects in eclipse.

Select the project version path you want to switch, or you can enter it directly.

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.