1+ mod direct_apply;
12mod source_index;
23
34use std:: collections:: { BTreeMap , BTreeSet } ;
@@ -10,6 +11,7 @@ use crate::ast::{Program, Type, TypeDeclaration, TypeDeclarationKind};
1011use crate :: diagnostic:: Diagnostic ;
1112use crate :: { graph, hir, lexer, parse, verify} ;
1213
14+ use self :: direct_apply:: apply_with_commit_hook;
1315use self :: source_index:: SemanticSourceIndex ;
1416
1517#[ derive( Debug ) ]
@@ -1995,39 +1997,6 @@ fn preflight_parsed_owned(
19951997 } )
19961998}
19971999
1998- fn apply_with_commit_hook (
1999- source_path : & Path ,
2000- patch_path : & Path ,
2001- hook : impl FnMut ( CommitPhase , & Path , & Path ) -> std:: io:: Result < ( ) > ,
2002- ) -> Result < String , Vec < Diagnostic > > {
2003- let guard = acquire_a0_commit_guard ( source_path) ?;
2004- let patch_source = std:: fs:: read_to_string ( patch_path) . map_err ( |error| {
2005- vec ! [ Diagnostic :: io(
2006- "SPX-I202" ,
2007- format!( "cannot read {}: {error}" , patch_path. display( ) ) ,
2008- ) ]
2009- } ) ?;
2010- let parsed_patch = parse_patch ( & patch_source) ?;
2011- let bounded_v3 = parsed_patch. schema == PatchSchema :: V3 ;
2012- let authenticated = if bounded_v3 {
2013- authenticate_a0_source ( & guard, Some ( ( crate :: repair:: MAX_SOURCE_BYTES , "SPX-R101" ) ) ) ?
2014- } else {
2015- authenticate_a0_source ( & guard, None ) ?
2016- } ;
2017- let source = authenticated. source ( ) . to_owned ( ) ;
2018- let preflight = preflight_parsed_owned (
2019- source,
2020- patch_source,
2021- source_path. to_path_buf ( ) ,
2022- parsed_patch,
2023- None ,
2024- None ,
2025- CandidateValidation :: Standalone ,
2026- ) ?;
2027- let prepared = prepare_a0_commit ( & authenticated, & preflight) ?;
2028- commit_prepared_a0 ( prepared, hook)
2029- }
2030-
20312000pub ( crate ) fn commit_prepared_a0 (
20322001 prepared : A0PreparedCommit < ' _ > ,
20332002 hook : impl FnMut ( CommitPhase , & Path , & Path ) -> std:: io:: Result < ( ) > ,
0 commit comments