RFR: 2002: GitToHgConverter fails on merge with ancestor

Zhao Song zsong at openjdk.org
Wed Aug 23 01:04:27 UTC 2023


On Tue, 22 Aug 2023 23:24:46 GMT, Erik Joelsson <erikj at openjdk.org> wrote:

> Sometimes through weird circumstances we can end up with Git repositories where merges between a commit and an ancestor to that commit. Converting such a commit to Mercurial can be tricky, and in one case we are currently failing.
> 
> The GitToHgConverter is already trying to solve this issue, but only detects the ancestor relationship in one direction between the commits to be merged, and not the other. Specifically if the first parent is an ancestor of the second parent, the conversion will identify the situation and apply the workaround. But, if instead the second parent is an ancestor of first parent, it's not detected. The first case is quite commonly achieved by merging a branch into the current branch using --no-ff, but the second seems rarer. The same workaround should apply fine in both cases however.
> 
> To verify this behavior I implemented two new tests, one for each of the possible ancestor relationships. The first test already passed, but the second was fixed by this change.
> 
> The FF.Auto case isn't tested, and is unlikely to ever be used, but I believe my change there makes it more correct than it was before.

Looks good!

-------------

Marked as reviewed by zsong (Reviewer).

PR Review: https://git.openjdk.org/skara/pull/1549#pullrequestreview-1590552939


More information about the skara-dev mailing list