Introduction to SVN

Source: Internet
Author: User
Tags svn client
This document will gradually teach you how to use the svn client during software development
Environment Simulation
Existing Project name: Test
Server version Library: Test
URL: http: // 10.155.11.10: 81/SVN
Developers: Deva and DEVB
Version library directory structure: 1. Basic operations
Step 1: Install the client
To the shared folder, download the TortoiseSVN-1.4.0.7501-win32-svn-1.4.0.msi installer, double-click to directly install. After the installation is successful, right-click the mouse and there will be two more options, SVN checkout and Tortoise SVN.
Step 2: Create a workspace
Before the project starts, create a folder on the hard disk of the local PC.
.
Step 3: Download the version Library
If a project is developed, the configuration administrator creates a version library test for the project on the server.
In the workspace folder, right-click the mouse. Select SVN checkout. The following window is displayed.
Enter the version library address in URL of repository, http: // 10.155.11.10: 81/SVN/test. In checkout Dir, the system automatically adds the workspace directory created in step 2.
In revision, select head revision to download to the latest version of the version library. If you want to download the old version of the library, select revision and enter the version number.
If you do not want to download the entire version library, but want to download the part of the module that you are responsible for, you can add the module name after the URL, such as http: // 10.155.11.10: 81/SVN/test/Doc.
Click OK and enter the user name and password.
Step 4: Modify the version Library
Modifications to the version Library include modifying the file content, adding and deleting files, and adding and deleting directories.
After step 3, the local workspace folder, that is, a green check box appears on the workspace, and the files in the workspace will also contain a green check box.
If a file in the database is modified, the system automatically adds a red exclamation mark to the file and its parent folders at all levels, indicating that the file or directory has been modified locally, 3 Figure 3
After modifying the version library, right-click the workspace folder and select Commit to submit the new version. after entering the password, the system will upload the modified version Library to the server, the version library is updated once.
Note:
After the new version is submitted, other users with write permission may repeat the preceding steps to update the version library. Therefore, before modifying the local version library in the workspace folder, you must first update the local version Library (right-click the workspace and select SVN updata) to download the latest version to the local, then, modify the file.
Ii. Other operations
In the daily software development process, in addition to the download, submission, and update operations described above, there are also several common operations.
(1) Compare the Differences Between Files
After soc_1 is modified, the soc_1 file displays a red exclamation mark, indicating that it has been modified. To view the difference between the modified soc_1 file and the file before modification, right-click the file, select diff. A window is displayed. 3. The window is divided into two parts: the previous version on the left and the version on the right. Mark and describe the differences. 4
If it is a Word document, after diff is selected, the system will open a Word document and mark the modified version as different from that before the modification. 4.1 (2) view logs if you want to view the logs of a file, such as soc_1, right-click the file and select Show log. The system will go out of a window, the logs of each soc_1 version are displayed in the window. 4 Figure 5 (3) view the version tree if you want to view the version tree of the soc_1 file, right-click the file and select revision graph. The system opens a window, the version tree of the file is displayed in the window. 6. Only version 4.5.6.7 is displayed because only version changed is selected. That is, 1.4.5.6.7 each version has a different version and is submitted after modification by the user. Version 2.3 and Version 1 are the same. (4) download the old version of an object. If you want to get the old version of an object, right-click the file and select updata to revision... You can. The system prompts you to enter the version number. For example, to download the fifth version of soc_1, enter 5. 7. After viewing the file of version 5, if you want to return to the latest version, you only need to run updata on soc_1. (5) Duplicate name and delete file if you want to delete a file or duplicate name a file, do not operate directly in windows. Right-click the file and select rename or delete. The SVN system completes the operation. After you rename or delete a file in the workspace, the file structure on the server will not change. The file structure on the server will be updated only after the new version library is submitted, that is, the commit. If the file is deleted by mistake, you can re-download the file to the local version library by upgrading the version library before submitting the version library, or restore the file through revert (refer to Article 8 ). If the file is deleted and submitted, you can only download the old version of the library to retrieve the file. For details, see (4 ). (6) Create the initial files soc_1, soc_2, word_1, and word_2 in the branch version library. To create a branch for soc_1, right-click soc_1 and select branch/Tag. A window is displayed, 8. In the window, from URL indicates that the branch to be created is the branch of soc_1 (which is automatically added and does not need to be changed ). In the to URL, you need to change the file name and add a flag after the file name. For example,
_ Branch ", the path does not need to be changed. In creat copy in the repository from, you can select that the Branch file is copied by the version of soc_1. Enter the log and select OK. After the branch is created, the updata version library, the system will download soc_1's main file and Branch file soc_1_branch to the local version Library at the same time, 8.1, and then you can operate on the Branch file. Soc_1 version tree 8.2

(7) Merge branch when you need to merge the soc_1_branc Branch file into the soc_1 trunk file, right-click soc_1, and select merge. A window is displayed, 9. In the from input box, enter the main stem URL, and in the to input box, enter the branch URL. In from and to, there are two options head revision and revision, indicating the version of soc_1 to be merged. After merging, the main file is marked with a red exclamation mark, indicating that the file has been modified and can be submitted. If the merged file is marked with a yellow exclamation mark, it indicates a file conflict. For the solution, see section 3 "Exception Handling ". (8) undo modification when a file is modified and saved (note that it is not submitted here). If you are not satisfied with the modification, you can right-click the modified file (the one with a red exclamation mark) and select revert. The previous changes will be undone and restored to the status after updata. If a file is accidentally deleted, you can right-click the directory where the file is located and select revert to restore it. Iii. Exception HandlingThe exception mentioned here mainly refers to a file conflict. Take Deva and DEVB as an example. When two users download the latest version library and submit modifications to soc_2 in the same file in the library, the Deva user first submitted will not have an exception, the second submitted user
DEVB cannot be submitted. Because the version library of the server has been updated by Deva, when the DEVB user uploads the file, the system will prompt error 10. In this case, DEVB users must first perform updata operations on the modified file. If two users modify the same location of the file soc_2, after the DEVB user executes updata, the system will merge the local soc_2 and the downloaded soc_2 from the server to a file, the file icon is marked with a yellow exclamation mark, indicating a file conflict. In the file, use <> to identify the conflict location and content. DEVB users can submit a conflict only after they negotiate with Deva, right-click the conflict, select resolve, and delete the conflict tag. Otherwise, the conflict cannot be submitted. File tag conflict format: <. Mine workspsace workspace, submit after the ABC workspace is submitted, a conflict should occur
======== Insert a paragraph here, ah, AAA, test conflict >>>>>>>>. r15 green section indicates the modification of local files. The blue section indicates the conflict between the latest version in the server version Library and the modification of local files. The purple color indicates that a conflict exists among the 15th versions ======== insert a paragraph here, ah, AAA, test conflict >>>>>>>. r15 green section indicates the modification of local files. The blue section indicates the conflict between the latest version in the server version Library and the modification of local files. The purple color indicates that the version number is 15th conflict.

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.