From ca1b89661481a41c4f2245a8c6a5ef73102a3fc2 Mon Sep 17 00:00:00 2001 From: Charlie Marsh Date: Tue, 13 Aug 2024 21:52:57 -0400 Subject: [PATCH] Remove same-graph merging in resolver --- crates/uv-resolver/src/resolution/graph.rs | 13 ++++---- crates/uv-resolver/src/resolver/mod.rs | 38 ---------------------- 2 files changed, 6 insertions(+), 45 deletions(-) diff --git a/crates/uv-resolver/src/resolution/graph.rs b/crates/uv-resolver/src/resolution/graph.rs index 08478f6e6b4b0..cd7f0b032e51e 100644 --- a/crates/uv-resolver/src/resolution/graph.rs +++ b/crates/uv-resolver/src/resolution/graph.rs @@ -1,19 +1,18 @@ use std::collections::BTreeSet; -use indexmap::IndexSet; -use petgraph::{ - graph::{Graph, NodeIndex}, - Directed, Direction, -}; -use rustc_hash::{FxBuildHasher, FxHashMap, FxHashSet}; - use distribution_types::{ Dist, DistributionMetadata, Name, ResolutionDiagnostic, ResolvedDist, VersionId, VersionOrUrlRef, }; +use indexmap::IndexSet; use pep440_rs::{Version, VersionSpecifier}; use pep508_rs::{MarkerEnvironment, MarkerTree, MarkerTreeKind, VerbatimUrl}; +use petgraph::{ + graph::{Graph, NodeIndex}, + Directed, Direction, +}; use pypi_types::{HashDigest, ParsedUrlError, Requirement, VerbatimParsedUrl, Yanked}; +use rustc_hash::{FxBuildHasher, FxHashMap, FxHashSet}; use uv_configuration::{Constraints, Overrides}; use uv_distribution::Metadata; use uv_git::GitResolver; diff --git a/crates/uv-resolver/src/resolver/mod.rs b/crates/uv-resolver/src/resolver/mod.rs index 525509f9d31db..838dbe906cb0b 100644 --- a/crates/uv-resolver/src/resolver/mod.rs +++ b/crates/uv-resolver/src/resolver/mod.rs @@ -387,29 +387,6 @@ impl ResolverState bool { - // TODO(konsti): The edges being equal is not a requirement for the graph being equal. While - // an exact solution is too much here, we should ignore different in edges that point to - // nodes that are always installed. Example: root requires foo, root requires bar. bar - // forks, and one for the branches has bar -> foo while the other doesn't. The resolution - // is still the same graph since the presence or absence of the bar -> foo edge cannot - // change which packages and versions are installed. - self.nodes == other.nodes && self.edges == other.edges - } -} - impl ResolutionPackage { pub(crate) fn is_base(&self) -> bool { self.extra.is_none() && self.dev.is_none()