Hi all,
In the past, there have been reports on the fossil-users mailing list
from people having problems with the merge command, almost invariably
involving renames. I actually ran into an issue with it myself before
but didn't have the time to look into it until recently.
The "merge-renames" branch is my effort to make any and all rename
scenarios mergeable. This is a fairly significant change, so here's a
few key points that will hopefully assist anyone reviewing the code:
* The current algorithm in trunk looks at three versions to determine
what changes need to be merged: V (the checked-out version), M (the
version being merged), and P (the pivot or baseline, by default the most
recent common ancestor of V and M). To these I've added a version N, or
a "name pivot". N is the most recent common ancestor of V and M that is
found by following only first parent links. This is necessary to fix
situations like [1] (test 6 in merge_renames.test). Thanks to Andy Goth
for reporting this issue and offering the solution.
* Tying into the previous point, the code for populating the FV table
has been completely overhauled. The main thing here is that we first
match up any renamed file from each version with its corresponding
filename in N, and then fill in the rest.
* Any new files added by the merge are now added after all other
operations are performed on the checkout. This allows you to do a merge
where, for example, A is renamed to B and then a new A is created (see
[2] as well as tests 5 and 9).
* The renaming logic has been enhanced to support moving a file to a
location that already exists in the currently checked out version, such
as when deleting a file and renaming another one to take its place (test
9) or even swapping filenames (test 10). Not terribly common cases, I
hope, but my feeling is that if it's possible to do, it should be
possible to merge.
This branch fixes a couple of merge tests that currently fail (marked as
"knownBug") in trunk, and the tests I've added cover every situation I
could think of to trip up the merge command. If there's anything I've
overlooked or need to improve/clarify, please let me know. Thanks!
[1]:
https://www.mail-archive.com/fossil-users%40lists.fossil-scm.org/msg20758.html
[2]:
https://www.mail-archive.com/fossil-users%40lists.fossil-scm.org/msg19169.html
_______________________________________________
fossil-dev mailing list
fossil-dev@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/fossil-dev