Custom Neo4j stored procedures for OSWatcher — recursive tree diffing over the merkle graph.
These procedures are deployed as a JAR plugin into Neo4j and power the diff engine used by neogit and oswatcher-plugins.
Recursively diffs two nodes in the OSWatcher merkle graph, yielding per-node change records.
CALL oswatcher.diffTreesRecursive(
parent_label, // String: node label to traverse (e.g. 'Tree', 'Blob')
base, // String|null: hash of the base node
diffee, // String|null: hash of the diffee node
base_path, // String: starting path prefix (e.g. '/')
filter, // List<String>: child labels to include (empty = all)
max_depth, // Long: depth limit (-1 = unlimited)
with_intermediates, // Boolean: include intermediate nodes
status_filter // List<String>: filter by status (empty = all except UNCHANGED)
)
YIELD status, type, path, old_props, new_props| Value | Behaviour |
|---|---|
|
Compare nodes themselves only (no children) |
|
Immediate children only |
|
n levels deep |
|
Unlimited recursion (default) |
| Value | Meaning |
|---|---|
|
Node exists only in diffee |
|
Node exists in both with different hash |
|
Node exists only in base |
|
Node exists in both with same hash (opt-in only) |
Empty list returns all statuses except UNCHANGED.
// Diff symbols between two Blobs (immediate children only)
CALL oswatcher.diffTreesRecursive('Blob', 'hash1', 'hash2', '/', ['Symbol'], 1, false, [])
YIELD status, path, old_props, new_props
// Full recursive filesystem tree diff
CALL oswatcher.diffTreesRecursive('Tree', 'hash1', 'hash2', '/', [], -1, false, [])
YIELD status, path
// Compare two nodes directly (git-log style, no recursion)
CALL oswatcher.diffTreesRecursive('Tree', 'hash1', 'hash2', '/', [], 0, false, [])
YIELD status, path
// Only show modified and new nodes
CALL oswatcher.diffTreesRecursive('Tree', 'hash1', 'hash2', '/', [], -1, false, ['MOD', 'NEW'])
YIELD status, pathRequires Java 17 and Maven 3.9+.
./mvnw clean packageThis produces target/oswatcher-procedures-1.0.0.jar. Deploy it to the plugins/ directory of your Neo4j instance and restart.
Download the latest JAR from Releases and place it in your Neo4j plugins/ directory. No configuration beyond Neo4j’s standard plugin loading is required.
Apache License 2.0 — see LICENSE.