Provide context necessary to resolve identity conflict. #8390
+376
−28
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Update error messaging to be a bit more clear where the conflict of identities is coming from.
Motivation:
#8311 — when multiple packages share the same identity (for example:
gh/swiftlang/swift-driver
andgh/apple/swift-driver
share the same identityswift-driver
) then the error doesn't help to resolve the conflict. It is particularly confusing when the conflicting package is pulled from transitive dependencies. I wanted to offer more context to resolve these types of conflicts, particularly:Modifications:
Result:
Before:
'swift-build': 'swift-build' dependency on 'https://github.com/swiftlang/swift-driver.git' conflicts with dependency on 'https://github.com/apple/swift-driver.git' which has the same identity 'swift-driver'.
After:
Conflicting identity for swift-driver: dependency 'github.com/swiftlang/swift-driver' and dependency 'github.com/apple/swift-driver' both point to the same package identity 'swift-driver'. The dependencies are introduced through the following chains: (A) /users/yy/pub/swift-package-manager->github.com/swiftlang/swift-build->github.com/swiftlang/swift-driver (B) /users/yy/pub/swift-package-manager->github.com/apple/swift-driver. If there are multiple chains that lead to the same dependency, only the first chain is shown here. To see all chains use debug output option. To resolve the conflict, coordinate with the maintainer of the package that introduces the conflicting dependency.
Plus also debug logs:
debug: 'swift-build': Conflicting identity for swift-driver: chains of dependencies for https://github.com/swiftlang/swift-driver.git: [[/users/yy/pub/swift-package-manager, github.com/swiftlang/swift-build, github.com/swiftlang/swift-driver]]
debug: 'swift-build': Conflicting identity for swift-driver: chains of dependencies for https://github.com/apple/swift-driver.git: [[/users/yy/pub/swift-package-manager, github.com/apple/swift-driver]]