RFR: 2002: GitToHgConverter fails on merge with ancestor

Erik Joelsson erikj at openjdk.org
Tue Aug 22 23:28:24 UTC 2023


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.

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

Commit messages:
 - SKARA-2002

Changes: https://git.openjdk.org/skara/pull/1549/files
 Webrev: https://webrevs.openjdk.org/?repo=skara&pr=1549&range=00
  Issue: https://bugs.openjdk.org/browse/SKARA-2002
  Stats: 78 lines in 2 files changed: 77 ins; 0 del; 1 mod
  Patch: https://git.openjdk.org/skara/pull/1549.diff
  Fetch: git fetch https://git.openjdk.org/skara.git pull/1549/head:pull/1549

PR: https://git.openjdk.org/skara/pull/1549


More information about the skara-dev mailing list