Svn plugin usage tutorial, svn usage tutorial

Source: Internet
Author: User
Tags version control system

Svn plugin usage tutorial, svn usage tutorial
I. svn Introduction

Subversion (SVN for short) is a version control system. A group of files are stored in the central version library, and each file and directory change is recorded. Subversion allows data to be restored to earlier versions, or check the data modification history. Subversion can access its version library through the network, so that users can operate on different computers.

Ii. Why svn?

Each programmer is responsible for developing one or more modules during programming, and many different versions are generated during development. This requires the programmer to effectively manage the code, you can quickly obtain the corresponding version as needed.

III, In eclipse Install svn plug-in on

1. Help --> Install New Software

2, click "Add", in the pop-up window, enter any name, and the corresponding SVN address http://subclipse.tigris.org/update_1.8.x, and then click "OK"

3. Select the two options and click Next.

4. Mark of successful installation:

Iv. svn plug-in usage 4.1 check out projects from svn

1. Start the check-out program: Open eclipse-> file-> import-> SVN-> select "check items from svn" and click "Next"

2. You have checked out a project before, configured the svn address, and directly selected the svn address of the project to be checked out, and then jumped to step 2. If the project is checked out for the first time and the svn address has never been configured, select "Create a new resource library location" and click "Next"

3. Enter the svn address. If the address is incorrect, a prompt is displayed. Enter the address successfully and click "finish"

4. Go to the svn repository project. You can view the tree-shaped project list, select the project to be checked out, click Select, and click "Next"

5. To facilitate identification, you do not need to change the name of the checked-out project or perform other configuration. You can simply select "check-out as a project in the workspace, if you want to check out the latest version and do not need to change anything, click "finish.

6. Select the version to be checked out, click "display log", select the svn version number to be checked out in the pop-up box, and click "OK ".

 

4.2 svn update project 4.2.1 why should I update the project before submitting it?

Update: update the code uploaded by others to the local environment. In this environment, you can merge your code into this version.

Each file of the Project detected by svn is marked with the version number, submission time, And submitter, and these identifiers are different. For example:

That is to say, a project is composed of several files with different version numbers, although each file in the project I checked out from SVN in the morning is the latest version, such as index. the jsp version is 2971, but after one day of work, when I want to submit code, I cannot guarantee

Each file of the project on the server is the same as that of the SVN check-out in the morning. Some colleagues may have submitted code during this period, so the version of a file that has been modified has changed, such as index. the jsp version is changed to 2972, but the version of my local file is not

There is a change, or 2971, If I modify the index. jsp, submit directly without updating, then the index I submitted. the jsp version will also change from 2971 to 2972, which will cause my file to overwrite the file submitted by my colleagues directly, and the work of my colleagues will be in vain. Therefore

Before submitting the code, you should first "Update". Not all files are updated, but individual files in the project, the purpose is to ensure that your version is consistent with the version updated by others.

4.2.2 Update Procedure

1. Right-click the specified project and choose "Team"> "synchronize with the resource library" from the context menu. In this case, we enter the team synchronization view. As shown in:

LocalUpdate. java is a new local file that does not exist on the server;

NewUpdate. java is a file created and submitted by others;

Test. java indicates that the local code has been changed without being updated to the latest version, and a conflict occurs.

Meanings of different logos:

 

Click the icon ① In the figure to display only the updated files on the server;

Click the icon ② to display only the locally modified files;

Icon ③ is the default current view of Eclipse and displays the files updated locally and on the server,

It can be determined from the direction of the arrow. To the left, the Arrow needs to be updated from svn to local, and to the right, it needs to be submitted from local to SVN.

Meanings of different logos:

2. in, select one or more files/folders updated on the server, right-click them, and click Update in the context menu ], you can update the latest version of the SVN server to a local project (click "Update" in the root directory of the selected project to update all the changed files on the server to the local directory ).

3. Conflict Resolution

Conflict 1: The server code is the same as the change of your own code

This situation is complicated. Generally, you can only save one copy of your code to your local computer, update the server code directly, and then modify your logic on the new code.

Conflict 2: The server code is different from the change of your own code

This is common because you and other developers are changing the same file. However, because the development tasks are separated, the changes are different. The solution is as follows:

① Double-click the conflicting file to enter the comparison view.

② Locate the new code block on the server but it does not exist locally, select this code block, and click the button in the upper right corner to copy the server code to the Local Machine (the operation is also performed elsewhere). If you click the button, close the comparison view and re-open it.

③ Copy the new code on all servers to the local file, right-click the conflict file and select mark as merge. Then the file will disappear in the Synchronize view, the code of the file has successfully merged the local code and remote code.

4.3 submit a project

Submit: the merged version can be submitted to svn for smooth running of the project. Others can develop the code based on the submitted version to ensure that the Code does not conflict with each other.

4.4 restore a file to a previous version

1. Right-click the specified file and choose Team> display resource history from the context menu.

2. A list of all historical versions of the current file is displayed. Right-click the specified version and choose "get content" from the context menu ", you can replace the local file with the file of this version, and then click "Submit.

Related Article

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.