You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Stefan Fuhrmann <st...@alice-dsl.de> on 2012/04/24 22:20:52 UTC
Merge-relevant information that is hard to come by
Hi all,
This post is meant to document two pieces of information
that SVN does not track explicitly and how that effects
SVN's merge logic. I'm not an expert on the merge code
as we use it in SVN right now, so feel free to correct me
if some of the following is already being addressed.
Also, I'm not advocating a specific change but want to see
whether people agree with my points and how they assess
their severity / importance.
(1) Renamed / moved nodes.
Everyone is probably aware that we don't record these
nodes other than as disappearing in one place and re-
appearing at some other place.
The thing is that even *with* move support in the back-end,
we could not rely on the mv command being used accurately
and consistently by our users. False positives might be less
common but there will be plenty of false negatives. Speaking
from my experience, from time to time I do add files that later
turn out to be replacements for other files that will be removed
soon after.
Other users may simply not care / know about the implications
of copy-with-history and mv but naturally move files on disk
and let the client UI DTRT. And there is lots of gray area where
semantics don't match well, e.g. file X superseding file Y but
can't and should not be merged. Still, the user wants to record
their semantic relationship ...
I'm all for recording moves as such but we will always have
to have a way identify moves after the respective changes
have already been committed. The good news is that >90%
of these cases can be identified programmatically it is just
somewhat expensive to do.
(2) Modified merges.
In case of textual conflicts, users will usually resolve them
before committing the merge result. Depending on policies,
a user may even need to modify textually successful merges
to e.g. fix a broken build before the merge may be committed.
The problem is that SVN will not record the difference between
the merge result and the combined change that eventually
get committed. This information is not lost because the system
could redo the merge and diff the result against the committed
change. But it is expensive to get that information.
To me, this has been even more annoying than tree-conflicts
due its consequences. SVN pretends that the commit contained
just the result of automatic merge and the user's input is being
ignored. If you try to merge the result back to the initial merge's
source, you are likely to get the same conflicts that have
already been resolved because that very resolution will not be
included in the merge.
From discussions with Julian, it seems that Symmetric Merge
could already do better while still "ignoring" the user's change.
I realize that a proper fix to this situation is difficult because
a single merge request may be broken down into multiple
ranges being merged sequentially. After each of them, there
may be a conflict being resolved manually etc. OTOH, there
is great potential in improving our merge performance
because differentiating between merge result and manual
intervention increases the amount of information available
to automatic conflict resolution / prevention.
-- Stefan^2.
Re: Merge-relevant information that is hard to come by -- Modified merges
Posted by Julian Foad <ju...@btopenworld.com>.
Stefan Fuhrmann wrote:
> (2) Modified merges.
> In case of textual conflicts, users will usually resolve them
> before committing the merge result. Depending on policies,
> a user may even need to modify textually successful merges
> to e.g. fix a broken build before the merge may be committed.
>
> The problem is that SVN will not record the difference between
> the merge result and the combined change that eventually
> get committed. This information is not lost because the system
> could redo the merge and diff the result against the committed
> change. But it is expensive to get that information.
Please read the "Identifying Logical Changes vs. Commits" section on the Wiki:
<wiki.apache.org/subversion/SupportedMergeScenarios#Identifying_Logical_Changes_vs._Commits>
I regard the editing of a merge result to be an *essential* and
*inherent* part of merging a logical change to another branch. Strictly
speaking, there is no canonical "merge result", there is only a combination of the user and his/her chosen tools(s) helping him/her to do the merge. For example, "the result" differs depending on whether the user has chosen kdiff3 or Subversion's built-in diff3.
> To me, this has been even more annoying than tree-conflicts
> due its consequences. SVN pretends that the commit contained
> just the result of automatic merge and the user's input is being
> ignored. If you try to merge the result back to the initial merge's
> source, you are likely to get the same conflicts that have
> already been resolved because that very resolution will not be
> included in the merge.
No, when you say "try to merge the result back", I think you're mixing up different issues.
> From discussions with Julian, it seems that Symmetric Merge
> could already do better while still "ignoring" the user's change.
>
> I realize that a proper fix to this situation is difficult because
> a single merge request may be broken down into multiple
> ranges being merged sequentially. After each of them, there
> may be a conflict being resolved manually etc. OTOH, there
> is great potential in improving our merge performance
> because differentiating between merge result and manual
> intervention increases the amount of information available
> to automatic conflict resolution / prevention.
This point of view has been stated many times on the dev list but I say it's bogus. Please try to figure out how that approach could work (at a high level) if you think it could.
- Julian
Re: Merge-relevant information that is hard to come by -- Renamed / moved nodes
Posted by Julian Foad <ju...@btopenworld.com>.
(I'm using separate Subject lines for my replies to your two points.)
Stefan Fuhrmann wrote:
> (1) Renamed / moved nodes.
> [...] even *with* move support in the back-end,
> we could not rely on the mv command being used accurately
> and consistently [...] And there is lots of gray area where
> semantics don't match well, e.g. file X superseding file Y but
> can't and should not be merged. Still, the user wants to record
> their semantic relationship ...
>
> I'm all for recording moves as such but we will always have
> to have a way identify moves after the respective changes
> have already been committed. The good news is that >90%
> of these cases can be identified programmatically it is just
> somewhat expensive to do.
I agree.
If we had originally designed Subversion such that renames are tracked only if the user identifies them at commit time, I would feel that was a good design for its time. But coming to the issue now, I think we have to do better than that, by having the ability to tweak the history to say "that was a rename, so start following it now".
Retroactive marking of renames (or merges) does make the semantics of the system more complex, so we need to specify it with care. For example, if we have a subroutine that traces a node (PATH1@REV1) forward through any renames up to revision REV3, and then we decide to call that subroutine twice on the two subranges (REV1->REV2) followed by (REV2->REV3), what rename-tracking info does it use for the (REV1->REV2) calculation? If it uses the rename-tracking info is versioned and it uses the version that was present at REV2, then it will find a different result than if it used the REV3 version of the info.
We have exactly this issue today with mergeinfo: a user can edit the mergeinfo to say that a particular merge was or was not done, but that updated info is only recorded on revisions from 'now' onward; the original mergeinfo where the merge was performed is not changed. So any algorithm traversing the repository and following mergeinfo will get different results depending on which mergeinfo it reads. I don't know if that is a cause of the sometimes unexpected behaviour of "svn log -g", for example, but I suspect it may well be a factor.
As far as I'm aware, we haven't formalized this issue (for mergeinfo) in the sense of having a description of how a mergeinfo-sensitive operation should behave when it needs to interpret old as well as current mergeinfo.
- Julian
Re: Merge-relevant information that is hard to come by
Posted by Travis <sv...@castle.fastmail.fm>.
On Apr 29, 2012, at 7:51 AM, Stefan Fuhrmann wrote:
> Another such case that I ran into recently is
> with reverse-merging changes. Those "un-merged"
> revisions seem not to re-appear on the "eligible
> for merge" list. Don't remember the specifics, though.
I seem to recall that that was a conscious decision: if the user performed a reverse-merge to undo a change, then the user has made a conscious choice and doesn't want to have to keep reverse-merging that change every time the branches might otherwise be sync'ed together.
Re: Merge-relevant information that is hard to come by
Posted by Stefan Fuhrmann <eq...@web.de>.
Am 24.04.2012 22:27, schrieb Daniel Shahaf:
> Stefan Fuhrmann wrote on Tue, Apr 24, 2012 at 22:20:52 +0200:
>> (2) Modified merges.
>> In case of textual conflicts, users will usually resolve them
>> before committing the merge result. Depending on policies,
>> a user may even need to modify textually successful merges
>> to e.g. fix a broken build before the merge may be committed.
>>
>> The problem is that SVN will not record the difference between
>> the merge result and the combined change that eventually
>> get committed. This information is not lost because the system
>> could redo the merge and diff the result against the committed
>> change. But it is expensive to get that information.
> I think there are two separate things that aren't recorded:
>
> - Changes done after the merge but before the commit
>
> - Which parts of the mergeinfo delta were physically merged, and which
> were added to the mergeinfo as part of merging a merge revision.
> (That is: 'svn merge -c 80 ^/trunk', where r80 changed svn:mergeinfo
> on ^/trunk.)
>
Agreed. There are several use-cases where the
semantics of our merge implementation (i.e.
whatever the algorithm decides to do based
upon the recorded data) and the user's intend
may not match. Or where that difference can
not be expressed formally.
Another such case that I ran into recently is
with reverse-merging changes. Those "un-merged"
revisions seem not to re-appear on the "eligible
for merge" list. Don't remember the specifics, though.
-- Stefan^2.
Re: Merge-relevant information that is hard to come by
Posted by Daniel Shahaf <da...@elego.de>.
Stefan Fuhrmann wrote on Tue, Apr 24, 2012 at 22:20:52 +0200:
> (2) Modified merges.
> In case of textual conflicts, users will usually resolve them
> before committing the merge result. Depending on policies,
> a user may even need to modify textually successful merges
> to e.g. fix a broken build before the merge may be committed.
>
> The problem is that SVN will not record the difference between
> the merge result and the combined change that eventually
> get committed. This information is not lost because the system
> could redo the merge and diff the result against the committed
> change. But it is expensive to get that information.
I think there are two separate things that aren't recorded:
- Changes done after the merge but before the commit
- Which parts of the mergeinfo delta were physically merged, and which
were added to the mergeinfo as part of merging a merge revision.
(That is: 'svn merge -c 80 ^/trunk', where r80 changed svn:mergeinfo
on ^/trunk.)