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

Method resolve_remote_url

atomic-cli/src/commands/pull/command.rs:255–271  ·  view source on GitHub ↗

Resolve the remote URL and any identity hint from the `--identity` flag. Returns `(url, identity_hint)` where `identity_hint` comes solely from the `--identity` CLI flag. If absent, `attach_identity` falls back to URL-subdomain inference.

(&self, repo: &Repository)

Source from the content-addressed store, hash-verified

253 /// the `--identity` CLI flag. If absent, `attach_identity` falls back to
254 /// URL-subdomain inference.
255 fn resolve_remote_url(&self, repo: &Repository) -> CliResult<(String, Option<String>)> {
256 // If it looks like a URL, use it directly
257 if self.remote.contains("://") {
258 return Ok((self.remote.clone(), self.identity.clone()));
259 }
260
261 // Look up named remote in repository configuration
262 match repo.get_remote(&self.remote) {
263 Ok(entry) => Ok((entry.url, self.identity.clone())),
264 Err(atomic_repository::RepositoryError::RemoteNotFound { .. }) => {
265 Err(CliError::RemoteNotFound {
266 name: self.remote.clone(),
267 })
268 }
269 Err(e) => Err(CliError::Repository(e)),
270 }
271 }
272
273 /// Get the local view name to pull into.
274 ///

Callers 1

run_asyncMethod · 0.45

Calls 4

RepositoryClass · 0.85
containsMethod · 0.45
cloneMethod · 0.45
get_remoteMethod · 0.45

Tested by

no test coverage detected