Project Optimization Experience Sharing (6) SVN conflicts and handling

Source: Internet
Author: User
Tags svn update

In the previous blog, we shared the idea of determining new requirements: view problems on a global basis. Today, we will share with you how to resolve SVN conflicts during project development: SVN conflicts and handling!

Introduction

Anyone who has developed a project knows that the company will use version control tools to develop a project. There are many version control tools, such as Clear case, CVS, Visual SourceSafe, SourceAnywhere, StarTeam, SVN, CVS, GIT and so on, some are old development tools, some are coming soon, all kinds of versions are available, and what we will talk about in this blog is commonly used version control tools: SVN conflict and handling.

Instance
1. Conflict generation

After the submission is successful, the version of the practice.txt file has changed to 1001. At the same time, the user B modifies the practice.txt file with a license number of 1000. after the modification is completed, the submission fails because it is not modified in the latest version 1001.

When a conflict occurs, subversion will save all target file versions in the current working directory [last updated version, current obtained version (version submitted by someone else), your own version, target file].

(1)now both users of a%bupdate the practice.txt file to the local device.

(2) The content of the original file is as follows:

(3) User A modifies the file and adds "User A changes-submit" to the server.

(4) User B modifies the file and adds "User B Modify-submit" to the server.

(5) When user B submits an update to the server, the following prompt is displayed:


When the user B submits the file to the server, the system prompts that the version has expired: first, update the version from the version library, and then resolve the conflict. After the conflict is resolved, the svn resolved (solution) should be executed ), then, check in to the version library. After the conflict is resolved, you must use svn resolved to notify the subversion to resolve the conflict so that updates can be submitted.

2. Conflict Processing

Method 1: discard your updates, use svn Revert (rollback), and then submit.


When svn revert is used, you do not need to use svn resolved to delete temporary files, because undo will restore all files before modification, except for the deleted files.

Method 2: discard your own updates and use others' updates. Use the latest version to overwrite the target file, execute resolved filename, and submit the file (right-click the file and choose solution );


Method 3: manually update the target file after communicating with other users when a conflict occurs. Then execute resolved filename to remove the conflict and finally submit the file.

(1) manually merge conflicting files: After you view a specific file with a conflict, you can open the file and find the conflict mark.
Top piece of bread
Mayonnaise
Lettuce
Tomato
Provolone
<. Mine
Salami
Mortadella
Prosciutto
========
Sauerkraut
Grilled Chicken
>>>>>>>. R2
Creole Mustard
Bottom piece of bread
A conflict occurs between the smaller and greater than the symbol. If you can perform svn resolved to delete three temporary files after modifying the file and deleting the conflict mark
Note: If you do not understand the modification, you can refer to the three files in the conflict.
 
(2) copy a work file (usually not frequently used): If you only want to cancel this modification, you can copy the file generated by svn to replace your work copy.
$ Svn update
C practice.txt
Updated to revision 2.
$ Ls practice .*
Practice.txt. mine practice.txt. r2 practice.txt. r1
$ Cp practice.txt. r2 practice.txt (here, r2 is the version file before your current update in the version Library)
$ Svn resolved practice.txt (used to delete three temporary files)


OK! Conflict Resolution!

Submit updates!



Summary

Sometimes conflicts are inevitable, but we can minimize the complexity of conflicts:

1. After the document is edited, submit the document as soon as possible. Frequent submission/updates can reduce the probability of conflict occurrence and the complexity of conflict resolution.

2. When submitting a request, write a clear message so that you can find out the reasons for the user's update later. After all, the reasons for the original update may be forgotten over time.

3. develop a good habit of using SVN. When SVN is used, it is submitted first and updated later. After opening it every morning, you must first obtain the latest version from the version library. You must submit all edited documents to the version library before getting off work every day.



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.