Symmetric merge and subtrees
From: Julian Foad <julianfoad_at_btopenworld.com>
Date: Tue, 17 Jul 2012 18:28:25 +0100 (BST)
There are some merge scenarios for which it's not clear whether the user should specify '--reintegrate' or not. We need to decide what the 'symmetric' (i.e. automatically-choosing) code should do in those cases.
The following example is adapted from merge_symmetric_tests.py 18, subtree_to_and_fro(), "reintegrate considers source subtree mergeinfo":
In terms of commands (assume a commit after each step):
svn cp A B
The output from "merge --reintegrate" is:
svn: E195016: Reintegrate can only be used if
But why did the user choose a 'reintegrate' merge in this example, when there has been no merge of the branch root in the A->B direction? Or, from another angle, what if we have this similar scenario?
Given this example, it looks like a non-reintegrate merge might be the user's choice for the final merge (and for the intermediate merge... either a reintegrate or non-reintegrate); but all that's changed in this example is which branch was branched from which, and that shouldn't make any difference. AFAIK we don't document a rule for whether '--reintegrate' should be used; it's ambiguous.
We have three possible results when we request a merge:
(1) a correct merge
Currently, 'merge' gives (2), 'merge --reintegrate' gives (3), and 'merge --symmetric' gives (2).
The subtree_to_and_fro() test expects 'merge --symmetric' to give result (3), but the symmetric merge currently sees that case as one in which a *non-reintegrate* merge is needed, and goes ahead to produce a merged result (with a conflict):
--- Merging r2 through r8 into 'A':
Is the symmetric merge 'broken'? This test claims so, on the basis of expecting it to behave like a reintegrate merge. However, we can't be strictly backward-compatible with both the reintegrate and the non-reintegrate behaviours if we have to pick one, because they differ. What do we want to see here?
I think it depends what the user is thinking. If the user is thinking "just help me merge everything that needs to be merged", then the user probably would have used the plain 'merge' command in 1.7, and would prefer a wrong merge with spurious conflicts, given that we haven't yet implemented a correct merge. If the user is thinking "this is a reintegration, and I believe my branch was sync'd with the trunk recently", then the user probably would prefer this merge to bail out like 'reintegrate' does.
It almost goes without saying that if and when we have implemented a correct merge then that is the right thing to do, and that will resolve the ambiguity. (When we do that, there is still the possibility of giving the user an option to make Subversion detect and report whether the required merge has anything complex about it -- subtrees, cherry-picked revisions, and so on -- because the user might want the mental security of confirming that in fact the merge is as simple as the user expects it to be. But that is another topic.)
Our options for what 'symmetric' merge will do, in cases like this , are:
(1) Implement correct merging.
If we choose (2), then we break strict compatibility with 1.7 'reintegrate' merge. If we choose (3), then we break strict compatibility with 1.7 'non-reintegrate' merge.
I'd like to do (1), but, in the meantime, would we be happy with one of the alternatives?
 At the moment, 'cases like this' means cases where the specified merge root node was last merged in the same direction as the current merge, or was never merged before. That is, the symmetric merge code chooses whether to do a reintegrate style of merge or a non-reintegrate style of merge based on the direction of this merge relative to the direction of the last merge of the specified root node, not based on any merges that may have been done to subtrees. That does NOT mean it doesn't handle subtrees; it handles them just the same as
-- Certified & Supported Apache Subversion Downloads: http://www.wandisco.com/subversion/downloadReceived on 2012-07-17 19:28:59 CEST
This is an archived mail posted to the Subversion Dev mailing list.