Skip to content

Commit

Permalink
Merge pull request #3213 from dependabot/updates/issues/1104-rust-issues
Browse files Browse the repository at this point in the history
Gracefully handle cargo version conflicts
  • Loading branch information
feelepxyz authored Mar 4, 2021
2 parents 14a6190 + ae7dafd commit 1374df6
Show file tree
Hide file tree
Showing 5 changed files with 313 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cargo/lib/dependabot/cargo/update_checker/version_resolver.rb
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,6 @@ def handle_cargo_errors(error)
raise Dependabot::GitDependencyReferenceNotFound, dependency_url
end

raise Dependabot::DependencyFileNotResolvable, error.message if resolvability_error?(error.message)

if workspace_native_library_update_error?(error.message)
# This happens when we're updating one part of a workspace which
# triggers an update of a subdependency that uses a native library,
Expand All @@ -237,6 +235,8 @@ def handle_cargo_errors(error)
return nil
end

raise Dependabot::DependencyFileNotResolvable, error.message if resolvability_error?(error.message)

raise error
end
# rubocop:enable Metrics/AbcSize
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -533,5 +533,16 @@
let(:dependency_files) { unprepared_dependency_files }
it { is_expected.to eq(Gem::Version.new("0.1.80")) }
end

context "when multiple packages have a version conflict with one another" do
let(:dependency_name) { "ructe" }
let(:dependency_version) { "0b8acfe5eea15713bc56c156f974fa05967d0353" }
let(:string_req) { nil }
let(:source) { { type: "git", url: "https://github.com/kaj/ructe" } }
let(:dependency_files) { project_dependency_files("version_conflict") }
let(:unprepared_dependency_files) { project_dependency_files("version_conflict") }

specify { expect(subject).to be_nil }
end
end
end
290 changes: 290 additions & 0 deletions cargo/spec/fixtures/projects/version_conflict/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions cargo/spec/fixtures/projects/version_conflict/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[package]
name = "version_conflict"
version = "0.1.0"
authors = ["[email protected]"]

[dependencies]
askama = { git = "https://github.com/djc/askama", branch = "main" }

[build-dependencies]
ructe = { git = "https://github.com/kaj/ructe" }
Empty file.

0 comments on commit 1374df6

Please sign in to comment.