You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by Apache Wiki <wi...@apache.org> on 2011/11/17 17:52:23 UTC
[Subversion Wiki] Update of "RepetitiveResolvingOfTheSameRename" by PhilipMartin
Dear Wiki user,
You have subscribed to a wiki page or wiki category on "Subversion Wiki" for change notification.
The "RepetitiveResolvingOfTheSameRename" page has been changed by PhilipMartin:
http://wiki.apache.org/subversion/RepetitiveResolvingOfTheSameRename
New page:
= The Problem =
The scenario is: a long-lived release branch getting bug fixes, and trunk undergoing development. Bug fixes are merged between the trunk and branch; there are two (at least) ways this can be handled. One is the approach used by the Subversion project: fix bugs on trunk and cherry-pick merge those changes to the release branch. Other organisations do it differently: they fix bugs directly on the branch and do catch-up merges to ensure that the changes get onto trunk.
Both approaches suffer when the trunk development renames files and directories as the rename often indicates major new development that is not suitable for the branch. This means that the merges raise tree conflicts that require user intervention to solve. The big problem is that having solved and committed a solution, the next merge is likely to produce essentially the same conflict requiring the user to go through the same steps to resolve it.
= The Aim =
We want the merge to automatically apply incoming changes to the moved items. These are not uncommitted local moves, they are moves that have been committed to the repository. So the solution is to identify moves in the repository history and then use those moves to adjust the incoming merge differences so that they apply to the moved item.
The first stage, identifying moves in the repository, is the subject of ongoing work (Record moves in the database, extracting them from the log history, etc.). Some work has also been done on getting update to understand local, uncommitted moves, and this can probably be extended.
It is not clear how well automatic move identification will work in practice. Even if it works well there will always be some moves that cannot be identified automatically, if only because the user simply made the move using add/rm without any sort of copy. Another scenario is splitting a file in two and later discarding one half.
The idea here is to allow the user to resolve conflicts by telling Subversion "A moved to B" and storing that information. This could happen before the merge, or during conflict resolution, or at some other time. The information gets stored in a property and committed so that it is available for subsequent merges. In this way the user only has to resolve the conflict once and repeat merges don't conflict.
This doesn't preclude automatic move identification. Initially we simply ask the user to resolve all moves, but as automatic move identification starts to work it can bypass asking (or perhaps suggest the answer).
= The Design =
== What information needs to be stored? ==
"A moved to B" obviously. "at rN"?
Do we need to store a revision range?
== Where is it stored? ==
In an svn:property of some sort. It may need special handling to merge changes to the property along the lines of svn:mergeinfo.
Do we store the property at the working copy root? In the parent of of the moved item?
Given A/B/C/D on one branch and suppose there have been three renames on the other branch at various times:
D->Z
C->Y
B->X
giving A/X/Y/Z. We could store all three moves in the root or we could store the B->X in A, C->Y in B and D->Z in C. Storing it in parent would mean that it automatically adjusted as the parent was moved. If this good or bad?
What would root storage look like? There are obviously ordering issues.
A/B/C/D->A/B/C/Z
A/B/C->A/B/Y
A/B->A/X
== How is the information obtained? ==
During interactive merge resolution?
"svn resolve --moved-to B A"
== When is it stored? ==
Like any property change it can be explicily committed, but generally it would be stored as part of the commit of the merge.
== Multiple branches? ==
Suppose two branches are merging to trunk, with one branch older than the other. The trunk may have made renames between the two branches. So A->B may apply to branch one while X->B may apply to branch two.
Does the conflict resolution stored on the source branch affect how it gets merged to the destination?
Is there transitive behaviour?
Re: [Subversion Wiki] Update of "RepetitiveResolvingOfTheSameRename"
by PhilipMartin
Posted by Johan Corveleyn <jc...@gmail.com>.
On Thu, Nov 17, 2011 at 5:52 PM, Apache Wiki <wi...@apache.org> wrote:
> Dear Wiki user,
>
> You have subscribed to a wiki page or wiki category on "Subversion Wiki" for change notification.
>
> The "RepetitiveResolvingOfTheSameRename" page has been changed by PhilipMartin:
> http://wiki.apache.org/subversion/RepetitiveResolvingOfTheSameRename
>
> New page:
[...]
> = The Aim =
>
> We want the merge to automatically apply incoming changes to the moved items. These are not uncommitted local moves, they are moves that have been committed to the repository. So the solution is to identify moves in the repository history and then use those moves to adjust the incoming merge differences so that they apply to the moved item.
No idea if this is relevant, but this sounds similar to
"variance-adjusted patching" [1] (a.k.a. diff4), but then for
tree-variances, and not only for text-changes.
>From [1]: "Variance adjustment is the process of transforming a patch
to account for differences that have arisen in the target text since
the patch was generated, so that the new patch will be applicable to
the new target text and yet still have the "same" effect as the old
patch. It is, in essence, patching a patch."
I don't know exactly why diff4 isn't actually used in our codebase
(for text-adjustments I mean) --- it's only used in
tools/diff/diff4.c. I guess that, apart from a shortage of tuits, the
reason may be the following observation (again [1]): "Note that the
algorithm is actually too powerful -- if taken to its logical limits,
it can generate patches that apply cleanly even when the user would
almost certainly prefer a conflict." Anyway, this all predates my
involvement in Subversion, so I really don't know.
[...]
> The idea here is to allow the user to resolve conflicts by telling Subversion "A moved to B" and storing that information.
Ok, so in case we can't (or can't yet) discover this information, we
may let the user tell us what kind of "variance-adjustment" needs to
be done (or put differently "what kind of adjustment took place
logically"), and store that information. Interesting.
[1] http://svn.apache.org/repos/asf/subversion/trunk/notes/variance-adjusted-patching.html
--
Johan