Skip to main content

Module diff

Module diff 

Source
Expand description

Diff engine for comparing two Code Property Graphs.

§Overview

This module loads or builds two CodePropertyGraphs (typically from two projects or two cached snapshots) and computes a symmetric difference: which functions, classes and call-edges were added, removed or stayed the same.

§Output

The result is a DiffReport containing two flat vectors:

  • nodes – every node present in at least one of the two graphs, tagged with Status.
  • edges – every unique (caller, callee, kind) tuple, also tagged with its status.

§Matching strategy

  • Nodes are matched by their name field (must be unique within a graph; the caller is responsible for disambiguation).
  • Edges are matched by the triple (source_name, target_name, edge_kind).

§Example

use icb_server::diff::{diff_graphs, Status};
use icb_graph::graph::CodePropertyGraph;

let old = CodePropertyGraph::new();
let new = CodePropertyGraph::new();
let report = diff_graphs(&old, &new);
assert!(report.nodes.is_empty());

Structs§

DiffEdge
A single edge in the diff output.
DiffNode
A single node in the diff output.
DiffReport
Complete result of a diff operation.

Enums§

Status
Status of an entity in the diff.

Functions§

diff_graphs
Compute the symmetric difference between two graphs.