pub struct WorktreeManager { /* private fields */ }Implementations§
Source§impl WorktreeManager
impl WorktreeManager
pub fn new(repo_root: PathBuf) -> Self
pub fn from_dir(dir: PathBuf) -> Result<Self>
Sourcepub fn create(&self, branch: &str, base: &str) -> Result<Worktree>
pub fn create(&self, branch: &str, base: &str) -> Result<Worktree>
Create a new worktree with a new branch based on base.
Sourcepub fn list(&self) -> Result<Vec<(String, PathBuf, bool)>>
pub fn list(&self) -> Result<Vec<(String, PathBuf, bool)>>
List all worktrees with branch name, path, and change status.
Sourcepub fn remove(&self, branch: &str, force: bool) -> Result<()>
pub fn remove(&self, branch: &str, force: bool) -> Result<()>
Remove a worktree by branch name. Fails if there are uncommitted changes (use force).
pub fn worktree_path(&self, branch: &str) -> PathBuf
pub fn find_worktree_path(&self, branch: &str) -> Result<Option<PathBuf>>
pub fn repo_root(&self) -> &Path
Auto Trait Implementations§
impl Freeze for WorktreeManager
impl RefUnwindSafe for WorktreeManager
impl Send for WorktreeManager
impl Sync for WorktreeManager
impl Unpin for WorktreeManager
impl UnsafeUnpin for WorktreeManager
impl UnwindSafe for WorktreeManager
Blanket Implementations§
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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