Skip to content

Commit

Permalink
Rename to nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
konstin committed Jul 22, 2024
1 parent b002213 commit 0a08734
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions crates/uv-resolver/src/resolution/graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,16 +73,16 @@ impl ResolutionGraph {
);

let mut petgraph: Graph<ResolutionGraphNode, Option<MarkerTree>, Directed> =
Graph::with_capacity(resolution.packages.len(), resolution.packages.len());
Graph::with_capacity(resolution.nodes.len(), resolution.nodes.len());
let mut inverse: FxHashMap<NodeKey, NodeIndex<u32>> =
FxHashMap::with_capacity_and_hasher(resolution.packages.len(), FxBuildHasher);
FxHashMap::with_capacity_and_hasher(resolution.nodes.len(), FxBuildHasher);
let mut diagnostics = Vec::new();

// Add the root node.
let root_index = petgraph.add_node(ResolutionGraphNode::Root);

// Add every package to the graph.
for (package, versions) in &resolution.packages {
for (package, versions) in &resolution.nodes {
let ResolutionPackage {
name,
extra,
Expand Down
10 changes: 5 additions & 5 deletions crates/uv-resolver/src/resolver/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ impl<InstalledPackages: InstalledPackagesProvider> ResolverState<InstalledPackag
let resolution = state.into_resolution();

// Walk over the selected versions, and mark them as preferences.
for (package, versions) in &resolution.packages {
for (package, versions) in &resolution.nodes {
if let Entry::Vacant(entry) = preferences.entry(package.name.clone()) {
if let Some(version) = versions.iter().next() {
entry.insert(version.clone().into());
Expand Down Expand Up @@ -2351,7 +2351,7 @@ impl ForkState {
.collect();

Resolution {
packages,
nodes: packages,
edges: dependencies,
pins: self.pins,
}
Expand All @@ -2364,7 +2364,7 @@ impl ForkState {
/// version specifiers to support diverging versions and requirements in different forks.
#[derive(Debug, Default)]
pub(crate) struct Resolution {
pub(crate) packages: FxHashMap<ResolutionPackage, FxHashSet<Version>>,
pub(crate) nodes: FxHashMap<ResolutionPackage, FxHashSet<Version>>,
/// If `foo` requires `bar>=3` and `foo` requires `bar <3` in another fork, we'd store it as
/// `(foo, bar) -> {>=3, <3}`.
pub(crate) edges: FxHashSet<ResolutionDependencyEdge>,
Expand Down Expand Up @@ -2401,8 +2401,8 @@ pub(crate) struct ResolutionDependencyEdge {

impl Resolution {
fn union(&mut self, other: Resolution) {
for (other_package, other_versions) in other.packages {
self.packages
for (other_package, other_versions) in other.nodes {
self.nodes
.entry(other_package)
.or_default()
.extend(other_versions);
Expand Down

0 comments on commit 0a08734

Please sign in to comment.