pub fn parse_scratchpad_diffs(raw_content: &str, worker_id: String) -> Vec<Hunk>Expand description
Parses scratchpad diff content from .hematite_scratch files into Hunk objects.
This function scans raw XML-ish content for <patch> tags and extracts:
start: Starting line number (fromstart="..."attribute)end: Ending line number (fromend="..."attribute)content: The patch content between<patch>and</patch>
§Arguments
raw_content— Raw string from scratchpad file containing patch tagsworker_id— Identifier of the worker processing this content
§Returns
A Vec<Hunk> with all parsed patches (stops at malformed or unclosed tags)
§Example
ⓘ
let xml = r#"<patch start="10" end="20">
// Some diff content
</patch>"#;
let hunks = parse_scratchpad_diffs(xml, "worker-1".to_string());
assert_eq!(hunks[0].start_line, 10);