You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Giovanni Bajo <ra...@develer.com> on 2006/07/12 23:16:26 UTC
[merge-tracking] replicating commits
Hello,
I believe the main functional problem I have with the way svnmerge.py operates
is that merges appear as totally different commits. Say I merge r10-20 from
branch to trunk. The merge will appear as a single commit (r100 for instance),
which totally hides the history of r10-20. For instance, neither "svn log" nor
"svn blame" will show any significant information for that merge: the whole
modification will appear as being done by the author of the merge.
This is especially bad for long-living large dev branches. When they are merged
into the trunk, the whole history of the branch is basically lost, "svn blame"
becomes less useful, ecc.
The idea I used to have with svnmerge.py was to replicate the commits.
Basically, svnmerge.py could be taught to apply the merge with different
commits, one for each revision being merged, and then tweak the revprops so
that the log/author/date would match those of the original commit. This would
bring meaningful svn log history, and perfect svn blame output. Technically
speaking, this method of replicating commits would have problems with conflicts
in merges, but you get the idea.
Did you already consider this problem? Do you have any possible solution in
mind? If you keep merge-tracking history in revprop, so that r100 has a revprop
saying "I'm a merge of r10-20" (which is what you are doing, IIRC), would it be
possible to tweak svn log/svn blame so that they follow these "merge links" and
display information based on the original revisions?
Giovanni Bajo
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: [merge-tracking] replicating commits
Posted by John Peacock <jp...@rowman.com>.
Giovanni Bajo wrote:
> If you do a single merge that spans 20 revisions, there is basically no
> level at which Subversion knows which revision each line of change comes
> from, especially since the user is free of fixing conflicts (which might
> mean renaming couple things, moving things around across files and so on)
> before the commit.
Right now 'svn blame' works back from the latest revision requested until it
finds where a given line was last changed. It does this by comparing what lines
changed in each revision, which is the only information available from the
repository, as it stores only deltas (gross handwaving here, since there are
several types of deltas stored, which makes it easier to go back to a given
revision). This has nothing to do with the merge tracking; this is the only way
that blame can operate. There is no master list of what line changed where; it
must be recreated each time.
What I am suggesting is that the blame algorithm could be extended to ignore the
single rev at which a merge was done and follow the trail back to the original
source, using the merge-tracking information. There is no way of knowing where
and when a conflict was resolved, because the *only* information available out
of the repository is that this file was changed at rev X from this => to that.
This is completely analogous to the way that the copy-from information was used
to more fully replicate a file's history when running log (see --stop-on-copy).
> After the commit happened, a property simply pointing to
> the list of revisions from which the merge was done might be enough to
> reconstruct information for "svn log", but surely not for "svn blame" and
> maybe not even for "svn log -v". Even if you exclude the case of conflicts
> manually fixed by the user, only back-guessing (for the purpose of svn
> blame) the normal context heuristic done when a patch is applied looks
> pretty hard to me.
You are expecting way more than the Subversion repository can ever provide. The
only thing you can _know_ is that this file changed at that rev, and these are
the changes. At any revision, you *always* know what files changed (e.g. log
-v), and you always know what lines were changed in those files (the delta).
The only question is whether the merge-tracking information is sufficient to
look past it for blame purposes (and I think there is no reason to believe that
it won't be).
There is no way to /a priori/ know that a conflict was resolved (though you
could always rerun the merge) because there may be local changes that were not
reflected in the repository during the merge. This is unknowable information
under any circumstances (and a good argument for a site policy to always perform
merges directly within the repository, not using local copies).
I should say that I have been using SVK for the last several years to perform
these merge operations with very good results. Sometimes I merge into my WC (if
it is something that I want to test before committing) and sometimes I merge
from URL to URL (if I know the change is harmless or I intend to test after and
commit additional changes). Either way, if a conflict is found, SVK helpfully
offers to run my chosen merge editor to resolve the conflict and continue with
the commit.
John
--
John Peacock
Director of Information Research and Technology
Rowman & Littlefield Publishing Group
4501 Forbes Blvd
Suite H
Lanham, MD 20706
301-459-3366 x.5010
fax 301-429-5747
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: [merge-tracking] replicating commits
Posted by Daniel Berlin <db...@dberlin.org>.
Giovanni Bajo wrote:
> John Peacock wrote:
>
>>> The problem is that you can't simply exclude the author: you'd want
>>> to see the original authors of the merged changes to appear instead.
>> You are conflating two different levels of information. At the
>> repository level, there is *one* author of the merge (the person
>> actually performing the merge). At the merge history level, you want
>> to be able to see original authors.
>>
>> In essence, the merge history needs to contain enough information to
>> retrieve the matching repository history, and nothing more. There is
>> no reason to duplicate the information from the repository (which is
>> not going anywhere). As long as the merge source (path and revision)
>> is available as properties, blame and log can be extended later to
>> follow this information backwards past the merge. This is true even
>> if the initial pass at merge tracking merely does what SVK already
>> does: automate repeated merges without conflict.
>
> Yes, I know the information is available somewhere, but I'm going to stress
> the point that it's impossible to properly extract it.
>
> If you do a single merge that spans 20 revisions, there is basically no
> level at which Subversion knows which revision each line of change comes
> from
It knows it came from those 20 revisions, and can just walk through them
to see which it appeared in.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: [merge-tracking] replicating commits
Posted by Giovanni Bajo <ra...@develer.com>.
John Peacock wrote:
>> The problem is that you can't simply exclude the author: you'd want
>> to see the original authors of the merged changes to appear instead.
>
> You are conflating two different levels of information. At the
> repository level, there is *one* author of the merge (the person
> actually performing the merge). At the merge history level, you want
> to be able to see original authors.
>
> In essence, the merge history needs to contain enough information to
> retrieve the matching repository history, and nothing more. There is
> no reason to duplicate the information from the repository (which is
> not going anywhere). As long as the merge source (path and revision)
> is available as properties, blame and log can be extended later to
> follow this information backwards past the merge. This is true even
> if the initial pass at merge tracking merely does what SVK already
> does: automate repeated merges without conflict.
Yes, I know the information is available somewhere, but I'm going to stress
the point that it's impossible to properly extract it.
If you do a single merge that spans 20 revisions, there is basically no
level at which Subversion knows which revision each line of change comes
from, especially since the user is free of fixing conflicts (which might
mean renaming couple things, moving things around across files and so on)
before the commit. After the commit happened, a property simply pointing to
the list of revisions from which the merge was done might be enough to
reconstruct information for "svn log", but surely not for "svn blame" and
maybe not even for "svn log -v". Even if you exclude the case of conflicts
manually fixed by the user, only back-guessing (for the purpose of svn
blame) the normal context heuristic done when a patch is applied looks
pretty hard to me.
Unless I'm seriously missing something, which is very well possible since
I'm no SVN guru :)
--
Giovanni Bajo
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: [merge-tracking] replicating commits
Posted by John Peacock <jp...@rowman.com>.
Giovanni Bajo wrote:
> The problem is that you can't simply exclude the author: you'd want to see
> the original authors of the merged changes to appear instead.
You are conflating two different levels of information. At the repository
level, there is *one* author of the merge (the person actually performing the
merge). At the merge history level, you want to be able to see original authors.
In essence, the merge history needs to contain enough information to retrieve
the matching repository history, and nothing more. There is no reason to
duplicate the information from the repository (which is not going anywhere). As
long as the merge source (path and revision) is available as properties, blame
and log can be extended later to follow this information backwards past the
merge. This is true even if the initial pass at merge tracking merely does what
SVK already does: automate repeated merges without conflict.
John
--
John Peacock
Director of Information Research and Technology
Rowman & Littlefield Publishing Group
4501 Forbes Blvd
Suite H
Lanham, MD 20706
301-459-3366 x.5010
fax 301-429-5747
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: [merge-tracking] replicating commits
Posted by Daniel Berlin <db...@dberlin.org>.
Giovanni Bajo wrote:
> Daniel Berlin wrote:
>
>> So, the real problem here is that merges are not considered a seperate
>> operation, they are just a bunch of adds, deletes, and changes applied
>> to a versioned tree. We don't know it's a merge if we look at
>> history.
>
> Roger that. Would it be possible to change this in future, or would it be
> too large a change for SVN and its architecture?
>
Anything can change. If you want to seriously propose it and work on it,
go for it. However, it's certainly not necessary to get good
history-sensitive blame, it's only necessarily to make it faster :)
:)
>> This is not necessary with the mergeinfo scheme, nor would it help.
>> It is just as good/bad as querying for a list of when mergeinfo has
>> changed for a given path, and saying any time forward mergeinfo
>> changed, the operation was a merge, not a real change, and exclude
>> that author from blame results (or something similar).
>
> The problem is that you can't simply exclude the author: you'd want to see
> the original authors of the merged changes to appear instead.
Yes, i'm aware.
>
> - Merge the py3k-branch into trunk, and (in a way) lose *whole* py3k
> history.
Only insofar as you mean "who wrote the original code" to mean "history" :)
Since py3k is expected to contain pretty substantial change, svn
> log / blame will be totally useless,
blame maybe, but not log, since log would tell you who made the original
change.
Blame is already "wrong" portions of the time anyway, just because of
the way it works.
and people will have to keep falling
> back to logging/blaming the py3k-branch (and don't even mention what the
> command line syntax would look like if they svn rm'd the py3k-branch after
> the merge...).
>
> - Close the trunk and rename the py3k-branch to trunk. This will keep the
> py3k history, but will lose the history of Python 2.x features, bugfixes,
> etc, since they would appear as big merges from the trunk happened in the
> branch. Also, developers will have large headaches trying to find out the
> magical command-line combination of -r, -c, and pegrevs to log/blame the
> "old" trunk before it was closed :)
>
> So, do you confirm that the ongoing work on merge-tracking will not improve
> this problem in any way?
So, uh, again, it will improve it in the way i've said before. It would
enable history-sensitive blame to work.
It will enable you to figure out where you'd need to look to determine
whether a change is really new, or just copied code.
This was not available before, because you didn't know where the merge
came from.
You can get fine history-sensitive blame this way.
This is a much more complicated algorithm than i described above, but a
simplified version is:
For each rev of the file you are blaming, in reverse (ie highest to
lowest revnum):
If the mergeinfo changed between this rev and the last
fetch the rev the current rev was merged from
determine what changes were not in the original merged-from rev, but
are in the current rev
Blame these with the current author
For all other parts of the file, determine which branch of the new
mergeinfo for this rev it came from (brute force, whatever).
Recurively blame this "chunk" as if we were blaming the rev/path it
came from.
Else
Blame normally
This will even handle when multiple portions of the file came from
multiple branches.
Do you believe that this kind of problem is a no-go
> with SVN now and ever, given its architecture, or do you foresee future ways
> to have this solved?
I think you can do history/merge sensitive blame without any
architecture changes, it just may be slower than you like.
It would certainly be a lot *easier* and *faster* if we knew which were
merges, and which were not. But it's not impossible, given the mergeinfo.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: [merge-tracking] replicating commits
Posted by Giovanni Bajo <ra...@develer.com>.
Daniel Berlin wrote:
> So, the real problem here is that merges are not considered a seperate
> operation, they are just a bunch of adds, deletes, and changes applied
> to a versioned tree. We don't know it's a merge if we look at
> history.
Roger that. Would it be possible to change this in future, or would it be
too large a change for SVN and its architecture?
> You will never perfectly be able to tell, even if you were to add a
> property, because someone could always tweak the property post-hoc.
... not that I care about people lying to themselves.
>> If you keep merge-tracking history in revprop, so that r100 has a
>> revprop saying "I'm a merge of r10-20" (which is what you are doing,
>> IIRC), would it be possible to tweak svn log/svn blame so that they
>> follow these "merge links" and display information based on the
>> original revisions?
>
> This is not necessary with the mergeinfo scheme, nor would it help.
> It is just as good/bad as querying for a list of when mergeinfo has
> changed for a given path, and saying any time forward mergeinfo
> changed, the operation was a merge, not a real change, and exclude
> that author from blame results (or something similar).
The problem is that you can't simply exclude the author: you'd want to see
the original authors of the merged changes to appear instead.
Let me give you a concrete scenario. Python developers created the
py3k-branch to work on the famous Python 3000 version. On trunk, development
is going on Python 2.x, and they are regularly merging from the trunk to
py3k-branch (using svnmerge.py right now). Now, one day in the future, when
the py3k work will be done (let's say it takes 2 years), they have two
possibility:
- Merge the py3k-branch into trunk, and (in a way) lose *whole* py3k
history. Since py3k is expected to contain pretty substantial change, svn
log / blame will be totally useless, and people will have to keep falling
back to logging/blaming the py3k-branch (and don't even mention what the
command line syntax would look like if they svn rm'd the py3k-branch after
the merge...).
- Close the trunk and rename the py3k-branch to trunk. This will keep the
py3k history, but will lose the history of Python 2.x features, bugfixes,
etc, since they would appear as big merges from the trunk happened in the
branch. Also, developers will have large headaches trying to find out the
magical command-line combination of -r, -c, and pegrevs to log/blame the
"old" trunk before it was closed :)
So, do you confirm that the ongoing work on merge-tracking will not improve
this problem in any way? Do you believe that this kind of problem is a no-go
with SVN now and ever, given its architecture, or do you foresee future ways
to have this solved?
--
Giovanni Bajo
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: [merge-tracking] replicating commits
Posted by Daniel Berlin <db...@dberlin.org>.
Giovanni Bajo wrote:
> Did you already consider this problem?
Yes, and I don't think replicating commits is a good answer, I think
it's a workaround :).
> Do you have any possible solution in
> mind?
So, the real problem here is that merges are not considered a seperate
operation, they are just a bunch of adds, deletes, and changes applied
to a versioned tree. We don't know it's a merge if we look at history.
You will never perfectly be able to tell, even if you were to add a
property, because someone could always tweak the property post-hoc.
That said,
> If you keep merge-tracking history in revprop, so that r100 has a revprop
> saying "I'm a merge of r10-20" (which is what you are doing, IIRC), would it be
> possible to tweak svn log/svn blame so that they follow these "merge links" and
> display information based on the original revisions?
This is not necessary with the mergeinfo scheme, nor would it help.
It is just as good/bad as querying for a list of when mergeinfo has
changed for a given path, and saying any time forward mergeinfo changed,
the operation was a merge, not a real change, and exclude that author
from blame results (or something similar).
One of the reasons for indexing mergeinfo was to make this querying very
very cheap.
--Dan
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: [merge-tracking] replicating commits
Posted by Daniel Rall <dl...@collab.net>.
On Thu, 13 Jul 2006, Giovanni Bajo wrote:
...
> I believe the main functional problem I have with the way svnmerge.py operates
> is that merges appear as totally different commits. Say I merge r10-20 from
> branch to trunk. The merge will appear as a single commit (r100 for instance),
> which totally hides the history of r10-20. For instance, neither "svn log" nor
> "svn blame" will show any significant information for that merge: the whole
> modification will appear as being done by the author of the merge.
>
> This is especially bad for long-living large dev branches. When they are merged
> into the trunk, the whole history of the branch is basically lost, "svn blame"
> becomes less useful, ecc.
>
> The idea I used to have with svnmerge.py was to replicate the commits.
> Basically, svnmerge.py could be taught to apply the merge with different
> commits, one for each revision being merged, and then tweak the revprops so
> that the log/author/date would match those of the original commit. This would
> bring meaningful svn log history, and perfect svn blame output. Technically
> speaking, this method of replicating commits would have problems with conflicts
> in merges, but you get the idea.
>
> Did you already consider this problem? Do you have any possible solution in
> mind? If you keep merge-tracking history in revprop, so that r100 has a revprop
> saying "I'm a merge of r10-20" (which is what you are doing, IIRC), would it be
> possible to tweak svn log/svn blame so that they follow these "merge links" and
> display information based on the original revisions?
While this topic came up during CollabNet's Merge Tracking Summit
<http://subversion.tigris.org/merge-tracking/summit.html>, the focus
was on how the author of the commit was displayed. Attendees were
interested in a transitive display for 'blame', with 'log' showing
both the original author and actual committer (if different). This is
described briefly in the "Auditing" section of the use case document
<http://subversion.tigris.org/merge-tracking/requirements.html#auditing>.
Personally, I find the idea of "transitive log messages" much more
useful! Do you see this as an optional behavior? Would it be the
default?
One problem use case: A change must be heavily modified (manually) to
the point where any description of specific code changes from the
original log message is nonsensical (e.g. 'merge --record-only',
manually apply some changes to a branch which has drifted FAR apart
from the merge source, commit). Seems like we'd want to have the
ability to provide an alternate log message here (preferably avoiding
a subsequent 'propedit svn:log').
Giovanni, would you mind adding this idea of "transitive log messages"
to the use case/requirements document?
Thanks, Dan