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

Method resolve_remote_url

atomic-cli/src/commands/push/command.rs:221–237  ·  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

219 /// the `--identity` CLI flag. If absent, `attach_identity` falls back to
220 /// URL-subdomain inference.
221 fn resolve_remote_url(&self, repo: &Repository) -> CliResult<(String, Option<String>)> {
222 // If it looks like a URL, use it directly
223 if self.remote.contains("://") {
224 return Ok((self.remote.clone(), self.identity.clone()));
225 }
226
227 // Look up named remote in repository configuration
228 match repo.get_remote(&self.remote) {
229 Ok(entry) => Ok((entry.url, self.identity.clone())),
230 Err(atomic_repository::RepositoryError::RemoteNotFound { .. }) => {
231 Err(CliError::RemoteNotFound {
232 name: self.remote.clone(),
233 })
234 }
235 Err(e) => Err(CliError::Repository(e)),
236 }
237 }
238
239 /// Get the local view name to push from.
240 ///

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