Skip to content

Commit

Permalink
Merge pull request #29 from JohanLarsson/main
Browse files Browse the repository at this point in the history
Use two different error messages.
  • Loading branch information
jnm2 committed Mar 20, 2024
2 parents 359ac31 + 11f7eb4 commit 94a227e
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/TfvcMigrator/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -253,14 +253,20 @@ private static RootPathChange ParseRootPathChange(string token)

foreach (var (_, parentChangeset, parentBranch) in mappingState.AdditionalParents.Where(t => t.Branch == branch))
{
if (commitsByChangeset.TryGetValue(parentChangeset, out var createdChangesets)
&& createdChangesets.SingleOrDefault(c => c.Branch == parentBranch).Commit is { } commit)
if (commitsByChangeset.TryGetValue(parentChangeset, out var createdChangesets))
{
parents.Add(commit);
if (createdChangesets.SingleOrDefault(c => c.Branch == parentBranch).Commit is { } commit)
{
parents.Add(commit);
}
else
{
throw new InvalidOperationException($"None of the commits created for the parent changeset {parentChangeset} has the expected branch {parentBranch}.");
}
}
else
{
throw new InvalidOperationException("Should not be reachable. Earlier code should have sorted topologically or failed.");
throw new InvalidOperationException($"A commit should have been created for the parent changeset {parentChangeset} before reaching this point.");
}
}

Expand Down

0 comments on commit 94a227e

Please sign in to comment.