pub struct RemoteManager<'a> { /* private fields */ }Expand description
Manager for repository remotes
Provides operations similar to git remote commands.
§Examples
let repo = registry.repo(repo_id)?;
let remote_mgr = repo.remote();
// Add remotes
remote_mgr.add("origin", "https://github.com/user/repo.git").await?;
remote_mgr.add("p2p", "gittorrent://peer/repo").await?;
remote_mgr.add("backup", "https://backup.com/repo.git").await?;
// List remotes
for remote in remote_mgr.list().await? {
println!("{}: {}", remote.name, remote.url);
}
// Change URL
remote_mgr.set_url("origin", "https://github.com/newuser/repo.git").await?;
// Remove remote
remote_mgr.remove("backup").await?;Implementations§
Source§impl<'a> RemoteManager<'a>
impl<'a> RemoteManager<'a>
Sourcepub async fn add(&self, name: &str, url: &str) -> Git2DBResult<()>
pub async fn add(&self, name: &str, url: &str) -> Git2DBResult<()>
Add a new remote
Similar to git remote add <name> <url>
Sourcepub async fn remove(&self, name: &str) -> Git2DBResult<()>
pub async fn remove(&self, name: &str) -> Git2DBResult<()>
Remove a remote
Similar to git remote remove <name>
Sourcepub async fn set_url(&self, name: &str, url: &str) -> Git2DBResult<()>
pub async fn set_url(&self, name: &str, url: &str) -> Git2DBResult<()>
Change a remote’s URL
Similar to git remote set-url <name> <url>
Sourcepub async fn rename(&self, old_name: &str, new_name: &str) -> Git2DBResult<()>
pub async fn rename(&self, old_name: &str, new_name: &str) -> Git2DBResult<()>
Rename a remote
Similar to git remote rename <old> <new>
Sourcepub async fn list(&self) -> Git2DBResult<Vec<Remote>>
pub async fn list(&self) -> Git2DBResult<Vec<Remote>>
List all remotes
Similar to git remote -v
Sourcepub async fn default(&self) -> Git2DBResult<Option<Remote>>
pub async fn default(&self) -> Git2DBResult<Option<Remote>>
Get default remote (usually “origin”)
Trait Implementations§
Source§impl<'a> RepositoryAccessor for RemoteManager<'a>
impl<'a> RepositoryAccessor for RemoteManager<'a>
Source§fn repo_path(&self) -> Git2DBResult<PathBuf>
fn repo_path(&self) -> Git2DBResult<PathBuf>
Get the repository worktree path
Source§fn open_repo(
&self,
) -> impl Future<Output = Git2DBResult<Repository>> + Send + '_where
Self: Sync,
fn open_repo(
&self,
) -> impl Future<Output = Git2DBResult<Repository>> + Send + '_where
Self: Sync,
Open the git repository (async, uses spawn_blocking) Read more
Auto Trait Implementations§
impl<'a> Freeze for RemoteManager<'a>
impl<'a> !RefUnwindSafe for RemoteManager<'a>
impl<'a> Send for RemoteManager<'a>
impl<'a> Sync for RemoteManager<'a>
impl<'a> Unpin for RemoteManager<'a>
impl<'a> UnsafeUnpin for RemoteManager<'a>
impl<'a> !UnwindSafe for RemoteManager<'a>
Blanket Implementations§
§impl<T> AnySync for T
impl<T> AnySync for T
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§impl<T> ServiceExt for T
impl<T> ServiceExt for T
§fn map_response_body<F>(self, f: F) -> MapResponseBody<Self, F>where
Self: Sized,
fn map_response_body<F>(self, f: F) -> MapResponseBody<Self, F>where
Self: Sized,
Apply a transformation to the response body. Read more
§fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>where
Self: Sized,
fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>where
Self: Sized,
High level tracing that classifies responses using HTTP status codes. Read more
§fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>where
Self: Sized,
fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>where
Self: Sized,
High level tracing that classifies responses using gRPC headers. Read more