MCPcopy Create free account
hub / github.com/Graphify-Labs/graphify / _owned_write

Function _owned_write

graphify/export.py:1058–1075  ·  view source on GitHub ↗

Write a graphify-owned file, refusing to overwrite a pre-existing file graphify didn't create. Returns True if the note is owned/current (whether or not it was physically written). The disk write is skipped when the content is byte-identical to what is already there

(rel_name: str, content: str)

Source from the content-addressed store, hash-verified

1056 _skipped: list[str] = []
1057
1058 def _owned_write(rel_name: str, content: str) -> bool:
1059 """Write a graphify-owned file, refusing to overwrite a pre-existing file
1060 graphify didn't create. Returns True if the note is owned/current (whether
1061 or not it was physically written).
1062
1063 The disk write is skipped when the content is byte-identical to what is
1064 already there (#3060) — an export re-runs on every graph.json change, and
1065 rewriting an unchanged note churns disk and fires inotify / re-index /
1066 sync for nothing. The note is still recorded in ``_written`` so it stays
1067 owned and is neither pruned as stale nor dropped from the manifest."""
1068 target = out / rel_name
1069 if target.exists() and rel_name not in _owned:
1070 _skipped.append(rel_name)
1071 return False
1072 target.parent.mkdir(parents=True, exist_ok=True)
1073 write_text_atomic_if_changed(target, content)
1074 _written.append(rel_name)
1075 return True
1076
1077 node_community = _node_community_map(communities)
1078

Callers 1

to_obsidianFunction · 0.85

Calls 1

Tested by

no test coverage detected