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

Method import_branch

atomic-cli/src/commands/git/import.rs:202–233  ·  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>,
        mainline_only: bool,
    )

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 mainline_only: bool,
209 ) -> CliResult<usize> {
210 // Get repository name from remote URL or working directory
211 let repo_name = self.get_repo_name(git_repo);
212
213 // Create parallel importer with options
214 let options = ParallelImportOptions {
215 incremental: self.incremental,
216 imported_shas: imported_shas.clone(),
217 repo_name,
218 ignored_path_patterns: import_ignore_patterns(
219 git_repo.workdir().unwrap_or_else(|| repo.root()),
220 self.kind.as_deref(),
221 ),
222 mainline_only,
223 graph_only: !self.with_crdt,
224 };
225
226 let importer = ParallelImporter::new(git_repo, options);
227
228 // Run the three-phase parallel import
229 let stats = importer.import_branch(branch_name, repo)?;
230
231 // Return total changes created (written + empty + merge)
232 Ok(stats.changes_written + stats.empty_commits + stats.merge_commits)
233 }
234
235 /// Get repository name from remote URL or working directory.
236 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