pub struct RepositorySynchronizer { /* private fields */ }Expand description
Main synchronizer struct
Implementations§
Source§impl RepositorySynchronizer
impl RepositorySynchronizer
Sourcepub fn new(repo_path: impl AsRef<Path>, config: SyncConfig) -> Result<Self>
pub fn new(repo_path: impl AsRef<Path>, config: SyncConfig) -> Result<Self>
Create a new synchronizer for the given repository path
Sourcepub fn new_with_transport(
repo_path: impl AsRef<Path>,
config: SyncConfig,
transport: Arc<dyn GitTransport>,
) -> Result<Self>
pub fn new_with_transport( repo_path: impl AsRef<Path>, config: SyncConfig, transport: Arc<dyn GitTransport>, ) -> Result<Self>
Create a new synchronizer with explicit git transport implementation
Sourcepub fn new_with_detected_branch(
repo_path: impl AsRef<Path>,
config: SyncConfig,
) -> Result<Self>
pub fn new_with_detected_branch( repo_path: impl AsRef<Path>, config: SyncConfig, ) -> Result<Self>
Create a new synchronizer with auto-detected branch name
Sourcepub fn new_with_detected_branch_and_transport(
repo_path: impl AsRef<Path>,
config: SyncConfig,
transport: Arc<dyn GitTransport>,
) -> Result<Self>
pub fn new_with_detected_branch_and_transport( repo_path: impl AsRef<Path>, config: SyncConfig, transport: Arc<dyn GitTransport>, ) -> Result<Self>
Create a new synchronizer with auto-detected branch and explicit git transport
Sourcepub fn get_repository_state(&self) -> Result<RepositoryState>
pub fn get_repository_state(&self) -> Result<RepositoryState>
Get the current repository state
Sourcepub fn has_local_changes(&self) -> Result<bool>
pub fn has_local_changes(&self) -> Result<bool>
Check if there are local changes that need to be committed
Sourcepub fn check_unhandled_files(&self) -> Result<Option<UnhandledFileState>>
pub fn check_unhandled_files(&self) -> Result<Option<UnhandledFileState>>
Check if there are unhandled file states that should prevent sync
Sourcepub fn get_current_branch(&self) -> Result<String>
pub fn get_current_branch(&self) -> Result<String>
Get the current branch name
Sourcepub fn get_sync_state(&self) -> Result<SyncState>
pub fn get_sync_state(&self) -> Result<SyncState>
Get the sync state relative to the remote
Sourcepub fn auto_commit(&self) -> Result<()>
pub fn auto_commit(&self) -> Result<()>
Auto-commit local changes
Sourcepub fn fetch_branch(&self, branch: &str) -> Result<()>
pub fn fetch_branch(&self, branch: &str) -> Result<()>
Fetch a specific branch from remote
Sourcepub fn fast_forward_merge(&self) -> Result<()>
pub fn fast_forward_merge(&self) -> Result<()>
Perform a fast-forward merge
Sourcepub fn detect_default_branch(&self) -> Result<String>
pub fn detect_default_branch(&self) -> Result<String>
Detect the repository’s default branch
Sourcepub fn get_target_branch(&self) -> Result<String>
pub fn get_target_branch(&self) -> Result<String>
Get the target branch (the branch we want to be on)
Sourcepub fn is_on_fallback_branch(&self) -> Result<bool>
pub fn is_on_fallback_branch(&self) -> Result<bool>
Check if we’re currently on a fallback branch
Sourcepub fn create_fallback_branch(&self) -> Result<String>
pub fn create_fallback_branch(&self) -> Result<String>
Create and switch to a fallback branch
Sourcepub fn push_branch(&self, branch_name: &str) -> Result<()>
pub fn push_branch(&self, branch_name: &str) -> Result<()>
Push a branch to remote (used for fallback branches)
Sourcepub fn can_merge_cleanly(&self, target_branch: &str) -> Result<bool>
pub fn can_merge_cleanly(&self, target_branch: &str) -> Result<bool>
Check if merging target branch into current HEAD would succeed (in-memory, no working tree changes)
Sourcepub fn try_return_to_target(&mut self) -> Result<bool>
pub fn try_return_to_target(&mut self) -> Result<bool>
Attempt to return to the target branch from a fallback branch