Re: Merge policies
From: Julian Foad <julianfoad_at_btopenworld.com>
Date: Thu, 19 Apr 2012 15:02:01 +0100 (BST)
Stefan Fuhrmann wrote:
> The following pre-commit scripts / policies would be useful.
It took me a few minutes to realize that you mean the hook is analyzing a commit to ^/trunk and is seeing mergeinfo additions that indicate both a merge from ^/sub-branch and a merge from ^/branch. And in this example the merge from ^/sub-branch was in fact a merge to ^/branch, which was committed in r20, and which is now propagating to ^/trunk.
In order for the hook to figure that out, starting from just looking at the mergeinfo change (which doesn't say what the target of each merge was), it has to examine revisions 10-20 of ^branch and notice that one of those revisions (r20, in fact) was the other merge that it's considering.
That's OK, it can do that; I'm just clarifying how it can figure out which merges "happened on the source branch".
I'll assume the admin can configure each of these policies to apply differently on different branches. That's mostly just a matter of inventing a suitable configuration scheme, presumably with branch name pattern matching or similar, and that would be totally necessary in a large project.
> * Strict merge hierarchy
Agreed, that policy would often be useful, even in that simple form ...
> In a more sophisticated implementation, we could identify /
... and very widely useful with those additions.
> * No sub-tree merges
Agreed: that policy would often be useful.
> * No aggregate merges
Agreed: that policy would often be useful.
> * No distributive merges
In other words: in any subtree merge (that is, when a subtree of the branch root is being merged separately or differently from its parent or the branch root), the 'source-left' subtree and the 'target' subtree must be traceable back to a common ancestor. In the absence of any renames or replacements inside either branch, this would mean that the two subtrees have the same relpath within each respective branch.
What we're rejecting here is any attempt such as:
mkdir trunk/subtree1 trunk/subtree2
Agreed, that policy is both almost universally useful, and is required from a functional point of view when we're doing "automatic" merges because the merge code needs to be able to trace them toward a common ancestor.
So I think such a merge would be rejected by the current (1.7) automatic-merge code already. (Haven't tried.)
Note: We also support a non-automatic merge, called a "2-URL" merge, where merge tracking is not attempted, and that (as I understand it) may allow such a merge.
> * No cherry picking
Agreed: that's sometimes useful. Maybe not so often as most of the other suggestions.
> * No criss-crossing
Agreed. I believe getting into a criss-cross situation would very rarely be intentional and would in general make the next merge more difficult than it would otherwise be.
> This only valid for non-cherry-picking merges and
Yes; I haven't fully grokked the detail, but I agree there's no need to stop cherry-picks crossing over.
> Except for the last one those checks will simply verify
Why do you suggest "no criss-crossing" is an exception? It seems also to be just verifying that the user followed certain policies.
> Again, the user shall be free to combine (or not use)
That's a classic case of merging among three branches. After doing that integration, the user will then expect to be able to merge A->B and B->A, and later do another similar integration via a new branch, B -> A_integration_2 -> A.
The only way in which I can see this scenario can be simpler than the general case, is that it would be reasonable to disallow A->B and B->A merges during the time while B->integ->A is happening.
> These checks become more complicated, requires
- Julian
|
This is an archived mail posted to the Subversion Dev mailing list.
This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.