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

Method import_branch

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

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