pub struct WorktreeManager { /* private fields */ }Expand description
Manager for git worktrees.
Implementations§
Source§impl WorktreeManager
impl WorktreeManager
Sourcepub fn new(repo_path: PathBuf, config: WorktreeConfig) -> Result<Self>
pub fn new(repo_path: PathBuf, config: WorktreeConfig) -> Result<Self>
Creates a new worktree manager.
Sourcepub fn create(
&self,
flow_id: Uuid,
task_id: Uuid,
base_ref: Option<&str>,
) -> Result<WorktreeInfo>
pub fn create( &self, flow_id: Uuid, task_id: Uuid, base_ref: Option<&str>, ) -> Result<WorktreeInfo>
Creates a worktree for a task.
Sourcepub fn path_for(&self, flow_id: Uuid, task_id: Uuid) -> PathBuf
pub fn path_for(&self, flow_id: Uuid, task_id: Uuid) -> PathBuf
Returns the default worktree path for a flow/task pair.
Sourcepub fn inspect(&self, flow_id: Uuid, task_id: Uuid) -> Result<WorktreeStatus>
pub fn inspect(&self, flow_id: Uuid, task_id: Uuid) -> Result<WorktreeStatus>
Inspects an existing worktree for a flow/task.
Sourcepub fn list_for_flow(&self, flow_id: Uuid) -> Result<Vec<PathBuf>>
pub fn list_for_flow(&self, flow_id: Uuid) -> Result<Vec<PathBuf>>
Lists all worktrees for a flow.
Sourcepub fn cleanup_flow(&self, flow_id: Uuid) -> Result<()>
pub fn cleanup_flow(&self, flow_id: Uuid) -> Result<()>
Cleans up all worktrees for a flow.
Sourcepub fn is_worktree(&self, path: &Path) -> bool
pub fn is_worktree(&self, path: &Path) -> bool
Checks if a path is a valid worktree.
Sourcepub fn worktree_head(&self, worktree_path: &Path) -> Result<String>
pub fn worktree_head(&self, worktree_path: &Path) -> Result<String>
Gets the HEAD commit of a worktree.
Sourcepub fn commit(&self, worktree_path: &Path, message: &str) -> Result<String>
pub fn commit(&self, worktree_path: &Path, message: &str) -> Result<String>
Creates a commit in a worktree.
Sourcepub fn config(&self) -> &WorktreeConfig
pub fn config(&self) -> &WorktreeConfig
Returns the config.
Auto Trait Implementations§
impl Freeze for WorktreeManager
impl RefUnwindSafe for WorktreeManager
impl Send for WorktreeManager
impl Sync for WorktreeManager
impl Unpin 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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.