SVN common operations

Source: Internet
Author: User

First step: Install the Client

After installation, in any blank space or file, folder right mouse button will be two more icons, respectively, SVN Checkout (svn checkout) and TORTOISESVN

Step Two: Create a workspace

Before the project starts, create a folder on the local PC's hard disk, and folder naming is optional (for example: credit Snorkeling 2

), which serves as a workspace for software developers during the project development process.

Step three: Download the repository

If you are developing a project now, the configuration administrator will build a repository for the project on the server.

On the credit insurance Snorkeling 2 folder, right-click the mouse. Select "SVN Checkout" and the following window will appear

Figure 1

Enter the repository address in URL of repository (repository URL), svn://172.28.84.27, in checkout dir The system automatically adds the workspace directory created by the second step d:\ credit insurance snorkeling 2.

Select fully recursive in the checkout depth.

In revision, select Head revision (the latest version), which will download to the latest and most complete version of the repository. If you want to download the old version of the file in the library, you can select revision (version) and fill in the version number.

If you do not want to download the entire repository, but only want to download the part of the module you are responsible for, you can add the module name after the URL, such as svn://172.28.84.27\12_??????? Manufactured.

Click OK to enter your user name and password

Fourth Step: Modify the Version library

Modifications to the repository include modifying the contents of the file, adding a delete file, and adding a delete directory.

After the third step of operation, the local workspace folder, that is, credit snorkeling 2 will have a green checkmark, the file under the workspace will also have a green checkmark, 2

Figure 2

Select the file you need to modify, right-click, select Get Lock as shown.

If the lock succeeds, the lock is added to the file, and if it fails, it will indicate that someone else is modifying the file.

To cancel the lock, right-click on the file and select Release Lock (where the original get lock is located).

Once locked, if a file in the library is modified, the system automatically adds a red exclamation mark to the file and the parent folder at each level of the file, representing that the file or directory has been modified locally, 3

Figure 3

When all modifications to the repository have been completed, right-click on the workspace folder and select Commit to commit the new version

After entering the username/password, the system will upload the modified repository to the server, that is, to complete the update of the repository.

Attention:

After the new version is submitted, other users with write permissions may repeat the steps above to complete the update of the repository. Therefore, each time you modify the local repository under a workspace folder, you must first update the local repository (right-click the workspace, select svn updata), download the latest version to local, and then modify it.

Two Other operations

In the daily software development process, in addition to the above introduction of the download, submit, update operations, there are several other common operations.

(1) Compare the differences between documents

When the soc_1 has been modified, the Soc_1 file will appear red exclamation mark, indicating that has been modified, if you want to see the modified Soc_1 file and before the change, you can right-click the file, select

Diff, the system out of a window, the window is divided into two parts, the left for the previous version of the change, the right is the version after the change. And make marks and descriptions in different places.

In the case of an Excel document, after selecting diff, the system opens an Excel window, which is divided into two sections, with the previous version being changed and the top being the changed version. And in which to mark the modified version and before the change is different. 4

Figure 4

(2) View Log

If you want to view a log of a file, such as Word_1, right-click the file and select Show log, the system will step out of a window and display the log for each version of the file in the window. 5

Figure 5

(3) View version tree

If you want to view the file's version tree, right-click the file, select Revision graph, the system will open a window and display the file's version tree in the window. 6.

Figure 6

Only four versions are displayed because only the versions that have changed have been selected and have been submitted after the user has modified them.

(4) Download an older version of a file

If you want to get an older version of a file, simply right-click on the file and select Updata to revision ... Can. You are prompted to enter a version number. For example, to download the 12th version of a file, just fill in 12. 7. After viewing the version 12 file, if you want to go back to the latest version here, just run Updata on the file.

Figure 7

(5) Renaming and deleting files

If you want to delete a file or rename a file, be careful not to manipulate it directly under Windows. Simply right-click the file, select Rename or delete, and the SVN system will complete the operation.

After renaming or deleting a file in credit snorkeling 2, the file structure of the server will not change, and the file structure of the server will not be updated until the new repository is committed.

If you delete a file by mistake, you can re-download the file to the local repository by upgrading the repository before you commit the repository, or you can restore it by revert (refer to eighth). If the file is deleted and has already been submitted, then retrieving the file can only be done by downloading the old repository, refer to (4).

(6) Create a branch

The original file Word_1,word_2 in the repository is a skeleton file. If you want to create a branch for word_1, just right-click Word_1, select Branch/tag, the system will pop up a window, 7. In the window, the from URL indicates that the branch to be created is a branch of word_1 (the system is automatically added without changes). In the to URL, you need to change the file name, add a flag after the file name, such as "_branch", the path does not need to change. In the creat copy on the repository from, you can choose which branch files are copied from the version of Word_1. Finally fill in the log, select OK.

Figure 7

After the branch is created, Updata (update) The repository to the local, the system will download the word_1 skeleton file and the branch file Word_1_branch simultaneously to the local repository, 8.1, and then the branch file can be manipulated. At this point the version tree of Word_1 8.2

Figure 8.1

Figure 8.2

(7) Merging branches

When you need to merge the Word_1_branc branch file into the word_1 skeleton file, right-click Word_1, select Merge, a window will pop up, 9.

Figure 9

In the From box, fill in the trunk URL and fill in the To box with the branch URL. In from and to, there are two options head revision and revision, which represent the version of Word_1 that is to be merged. After merging, the skeleton file will be marked with a red exclamation mark, indicating that it has been modified and can be submitted. If the merged file is marked with a yellow exclamation mark, the file has a conflict, the processing method is described in Part three, "Exception handling."

(8) Revocation of changes

When a file has been modified and saved (note that there is no commit), if you are not satisfied with the changes, if you want to re-modify, you can right-click on the modified file (the one with the red exclamation mark), and then select Revert, the previous series of changes will be revoked, revert to the state after Updata. If a file is deleted by mistake, you can also restore it by right-clicking the directory where the file resides and selecting Revert.

Three Exception handling

The exception mentioned here mainly refers to the file conflict. Take user Huyuan and user Liuxl as an example,

When two users download the latest repository at the same time, and the same file Word_2 in the library to modify the submission, the first committed user Huyuan no exception, the second committed user LIUXL will be unable to submit the phenomenon. Because the server's repository has been Huyuan updated, LIUXL users will be prompted to make an error when uploading.

In this case, the LIUXL user needs to perform a Updata file operation on the modified file first. If two users have modified the same place in the file Word_2, after the LIUXL user executes updata, the system merges the local word_2 with the download word_2 from the server to a file with a yellow exclamation mark on the file icon, indicating that the file is out of conflict. Identify conflict locations and conflicting content in files through <<<<<< and >>>>>>. Word_2 the user only negotiates with Huyuan, the conflict is processed, then right-click, select Resolve, the conflict flag is removed before it can be submitted again, otherwise it cannot be submitted.

The blue section indicates where the latest version in the server-side repository conflicts with local file modifications.

Purple indicates that the first version of the conflict has occurred

SVN common operations

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.