@@ -1135,6 +1135,18 @@ def main(argv: list[str]) -> int:
11351135 (OUTPUT_ROOT / str (tl )).mkdir (parents = True , exist_ok = True )
11361136 manifest = Manifest .load (MANIFEST_PATH )
11371137 resume = not args .no_resume
1138+ source_cache_dir = Path (args .source_cache_dir ) if args .source_cache_dir else None
1139+ source_dir_roots = [Path (p ) for p in args .source_dir_root ]
1140+ if args .source_cache_only and source_cache_dir is None :
1141+ raise SystemExit ("--source-cache-only requires --source-cache-dir" )
1142+ if args .source_cache_populate_only and source_cache_dir is None :
1143+ raise SystemExit ("--source-cache-populate-only requires --source-cache-dir" )
1144+ if args .source_cache_populate_only and args .source_cache_only :
1145+ raise SystemExit ("--source-cache-populate-only cannot be combined with --source-cache-only" )
1146+ if args .source_cache_populate_only and args .commit_source :
1147+ raise SystemExit ("--source-cache-populate-only is code-only; remove --commit-source" )
1148+ if source_dir_roots and (source_cache_dir is not None or args .source_cache_only ):
1149+ raise SystemExit ("--source-dir-root cannot be combined with source cache flags" )
11381150
11391151 # Shared global dedup db (cross-repo + cross-stream). FAIL LOUD up front:
11401152 # open it once here so a bad path / missing datasketch crashes before any
@@ -1223,18 +1235,6 @@ def main(argv: list[str]) -> int:
12231235 def should_process (repo : str ) -> bool :
12241236 return is_code_worktree_repo (repo ) and not (resume and manifest .is_done (repo ))
12251237
1226- source_cache_dir = Path (args .source_cache_dir ) if args .source_cache_dir else None
1227- source_dir_roots = [Path (p ) for p in args .source_dir_root ]
1228- if args .source_cache_only and source_cache_dir is None :
1229- raise SystemExit ("--source-cache-only requires --source-cache-dir" )
1230- if args .source_cache_populate_only and source_cache_dir is None :
1231- raise SystemExit ("--source-cache-populate-only requires --source-cache-dir" )
1232- if args .source_cache_populate_only and args .source_cache_only :
1233- raise SystemExit ("--source-cache-populate-only cannot be combined with --source-cache-only" )
1234- if args .source_cache_populate_only and args .commit_source :
1235- raise SystemExit ("--source-cache-populate-only is code-only; remove --commit-source" )
1236- if source_dir_roots and (source_cache_dir is not None or args .source_cache_only ):
1237- raise SystemExit ("--source-dir-root cannot be combined with source cache flags" )
12381238 if args .source_cache_populate_only :
12391239 report = populate_source_cache (
12401240 work_root ,
0 commit comments