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

Method import_branch

atomic-cli/src/commands/git/import.rs:211–245  ·  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

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