MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / import_branch

Method import_branch

atomic-cli/src/commands/git/import.rs:208–242  ·  view source on GitHub ↗

Import a single branch into an Atomic view using parallel processing.

(
        &self,
        git_repo: &GitRepository,
        branch_name: &str,
        repo: &mut Repository,
        imported_shas: &HashSet<String>,
        known_states: &HashSet<atomic_core::types:

Source from the content-addressed store, hash-verified

206impl Import {
207 /// Import a single branch into an Atomic view using parallel processing.
208 fn import_branch(
209 &self,
210 git_repo: &GitRepository,
211 branch_name: &str,
212 repo: &mut Repository,
213 imported_shas: &HashSet<String>,
214 known_states: &HashSet<atomic_core::types::Merkle>,
215 mode: BranchImportMode,
216 ) -> CliResult<usize> {
217 // Get repository name from remote URL or working directory
218 let repo_name = self.get_repo_name(git_repo);
219
220 // Create parallel importer with options
221 let options = ParallelImportOptions {
222 incremental: self.incremental,
223 imported_shas: imported_shas.clone(),
224 repo_name,
225 ignored_path_patterns: import_ignore_patterns(
226 git_repo.workdir().unwrap_or_else(|| repo.root()),
227 self.kind.as_deref(),
228 ),
229 mainline_only: mode.mainline_only,
230 graph_only: !self.with_crdt,
231 preserve_working_copy: mode.preserve_working_copy,
232 target_view: branch_name.to_string(),
233 known_states: known_states.clone(),
234 };
235
236 let importer = ParallelImporter::new(git_repo, options);
237
238 // Run the three-phase parallel import
239 let stats = importer.import_branch(branch_name, repo)?;
240 // Return total changes created (written + empty + merge)
241 Ok(stats.changes_written + stats.empty_commits + stats.merge_commits)
242 }
243
244 /// Get repository name from remote URL or working directory.
245 fn get_repo_name(&self, git_repo: &GitRepository) -> String {

Callers 1

runMethod · 0.45

Calls 4

import_ignore_patternsFunction · 0.85
get_repo_nameMethod · 0.80
cloneMethod · 0.45
rootMethod · 0.45

Tested by

no test coverage detected