SVN: must be related to

I get the error above when I use the second SVN merge option, i.e. "Reintegrate branch / auto merge." I understand why I get the error, that is, because when I created the branch, I just dragged the project to a new branch from Trunk (using Repo-Browser) instead of one of the following methods:

  • Use the Copy To option in the Repo Browser
  • Use the Branch / Tag parameter (right-click on the project in Windows Explorer and select TortoiseSVN / Branch / Tag)

I have three questions:

+4
source share
1 answer

Why should projects be related? This question assumes that SVN simply does a file comparison if this option is selected: SVN Combines a range of changes and reintegration.

Merging is not just copying file changes from one branch to another, it is a comparison of the last common ancestor with the combined two files. This is a three-way merger.

Let's say you have a file on the trunk:

Line #1 Line #2 Line #3 Line #4 

You create a branch of this file.

In branch, you change line # 4 as:

 Line #1 Line #2 Line #3 Line #4 FOO FOO FOO 

On the trunk, you change line number 3 to

 Line #1 Line #2 Line #3 BAR BAR BAR Line #4 

Subversion compares the last common ancestor (the file version before any changes) with the file versions you are merging. If I connect the trunk to a branch, Subversion sees that I have changed line number 3 on the trunk, but not line number 4. Therefore, a change in line No. 3 must be rescheduled, but the difference in line No. 4 is the result of a change on the branch, and I should not copy line No. 4 from the trunk

The merged file is as follows:

 Line #1 Line #2 Line #3 BAR BAR BAR Line #4 FOO FOO FOO 

Subversion also takes into account previously added changes and changes that you want to skip. This is actually a pretty good merge tool unless you start renaming files and moving them at wholesale prices. (Assume this is fixed in Subversion 1.9).

So, in order for the merge to work, the two files must share a common ancestor, which can be used as the basis for the merge. Without it, Subversion will not be able to determine which lines of the file were changed on the trunk, and what was changed on the branch. Otherwise, it simply copies files from one branch to another.

You can try the parameter - ignore-ancestry . This forces Subversion to consider merging as diff.

Are both options set above related to the project?

None of the options (I take it, you think about --reintegrate even without this option) make the project related to the database. This comes from creating a branch via svn cp . --reintegrate versus w / o reintegration is related to how the merger should happen. When you merge with a base stream (usually with a trunk) into your branched stream, you merge the changes that have occurred in your base stream into a branched stream. This creates new changes. When you merge back, Subversion sees new versions and wants to merge these changes back into your base stream. The reintegrate option removes this because of what is happening.

And when you reintegrate, you create a new version in your base stream, so you should not merge with your forked stream back into the base stream when you use --reintegrate . You can overcome this by merging --record-only from the branch stream to the base stream immediately after --reintegrate .

Just dragging and dropping a project from Trunk to Branch makes the project offline?

Depends on the Subversion client. Some Subversion GUI clients understand drag and drop as svn cp , rather than just copying files to another directory. However, TortoiseSVN works through Windows Explorer, so the default drag and drop is a copy of the file system. If you right-click on the drag and drop, select svn cp instead of a copy of the Windows file system.

+13
source

Source: https://habr.com/ru/post/1499008/


All Articles