Integrated: 2002: GitToHgConverter fails on merge with ancestor

Erik Joelsson erikj at
Wed Aug 23 13:44:04 UTC 2023

On Tue, 22 Aug 2023 23:24:46 GMT, Erik Joelsson <erikj at> 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.

This pull request has now been integrated.

Changeset: 67d9f091
Author:    Erik Joelsson <erikj at>
Stats:     78 lines in 2 files changed: 77 ins; 0 del; 1 mod

2002: GitToHgConverter fails on merge with ancestor

Reviewed-by: zsong



More information about the skara-dev mailing list