MCPcopy Create free account
hub / github.com/HKUDS/OpenSpace / _compute_files_diff

Function _compute_files_diff

openspace/skill_engine/patch.py:944–959  ·  view source on GitHub ↗

Compute combined unified diff from two snapshot dicts.

(
    old_files: Dict[str, str],
    new_files: Dict[str, str],
)

Source from the content-addressed store, hash-verified

942 return _collect_files(skill_dir)
943
944def _compute_files_diff(
945 old_files: Dict[str, str],
946 new_files: Dict[str, str],
947) -> str:
948 """Compute combined unified diff from two snapshot dicts."""
949 all_names = sorted(set(old_files) | set(new_files))
950 parts: list[str] = []
951 for name in all_names:
952 d = compute_unified_diff(
953 old_files.get(name, ""),
954 new_files.get(name, ""),
955 filename=name,
956 )
957 if d:
958 parts.append(d)
959 return "\n".join(parts)
960
961def _collect_files(directory: Path) -> Dict[str, str]:
962 """Collect all text files in a directory (recursive).

Callers 1

fix_skillFunction · 0.85

Calls 2

compute_unified_diffFunction · 0.85
getMethod · 0.80

Tested by

no test coverage detected