Preface:
1. Common status of SVN branch merge
U: Update (there is no local modification, and the merged branches are modified)
G: Merge (the local branches are modified, but the merged branches are also modified. However, you can merge them using SVN rules)
C: Conflict (local modifications, merged branches, and SVN internal rules cannot be merged)
2. SVN processing is a basic unit of behavior
The content looks quite long, but most of them are images. If you are interested, please read them. Haha!
The main code of a file is as follows:
Note that the last bean is wangwangmessagedao (row 29th), then an empty row (row 30th), and then the end Of the beans (row 31st)
We pulled two branches from the trunk for development, namely branching and branch2. Let's first look at the code after branching:
Branching is modifying the bean of the 29th rows (this is not the main analysis of this time), and then adding a bean below (this is the focus)
Let's take a look at branch2's code modifications.
Branch2 also adds a new bean under the bean of row 29th.
Branching merges branch2, which is obvious and conflicted.
Cause of conflict analysis: First branch2 modified 29th rows, but branch2 did not modify 29 rows. Therefore, this will not cause a conflict, therefore, the conflict may only be caused by the addition of a new configuration item in both branch. What is interesting is the following two phenomena.
C aliadmin-web/src/main/webapp/META-INF/autoconf/biz-dao.xml.vm
In branching, modify the file, delete an empty row, and merge it...Merge result:
G aliadmin-web/src/main/webapp/META-INF/autoconf/biz-dao.xml.vm
The files in branching are modified to delete the two empty rows and merged...
Merge result:
G aliadmin-web/src/main/webapp/META-INF/autoconf/biz-dao.xml.vm
Symptom Analysis (you can look at it through the tortoise in a simple way) First, let's look at the svn description that branching initially modified.The modification of the file is considered to be a 29-line delete and add operation (that is, modification), and then in 30 rows (empty rows) and 31 rows (end rows) added information
Let's take a look at the svn Description Modified by branch2.File modification is considered to have added information between 30 rows and 31 rows
It also adds information between 30 rows and 31 rows, so the conflict
Next, let's take a look at the svn Description Modified after branch2 deletes an empty row.The modified 31st rows of the file are considered as the 30th rows of the basic file. In this way, a new row is added between 29 and 30 rows of the original file.
In this way, branch2 adds something between lines 30 and 31, while branch2 adds a line between lines 29 and 30, so there is no conflict.
Let's take a look at the svn Description Modified after branch2 deletes two blank lines.After removing the two empty rows, SVN considers the 30th rows to be modified to the new content.
Branch2 is added between 30 rows and 31 rows, and branch2 is modified to 30th rows, so there is no conflict.
A sigh: SVN is very "sensitive" to spaces"DescriptionWhen merging branches, you should not only pay attention to C, but also take a look at G. Otherwise, SVN "intelligence" may not necessarily be what you want.