Skip to main content

Module sync

Module sync 

Source
Expand description

Sync manager for fetch and pull operations.

This module provides functionality for syncing existing local repositories with their remotes, including parallel fetch and pull operations.

§Example

use git_same::operations::sync::{SyncManager, SyncManagerOptions, SyncMode, LocalRepo, NoSyncProgress};
use git_same::git::ShellGit;
use git_same::types::{OwnedRepo, Repo};
use std::path::PathBuf;

let git = ShellGit::new();
let options = SyncManagerOptions::new()
    .with_concurrency(4)
    .with_mode(SyncMode::Fetch);

let manager = SyncManager::new(git, options);

// repos would come from discovery
let repos: Vec<LocalRepo> = vec![];
let progress = NoSyncProgress;

let (summary, results) = manager
    .sync_repos(repos, std::sync::Arc::new(progress))
    .await;

println!("Synced {} repos, {} had updates", summary.success,
    results.iter().filter(|r| r.had_updates).count());

Structs§

LocalRepo
A repository with its local path for syncing.
NoSyncProgress
A no-op progress implementation.
SyncManager
Manages parallel sync operations.
SyncManagerOptions
Options for the sync manager.
SyncResult
Result of a single sync operation.

Enums§

SyncMode
Sync mode - fetch only or pull.

Traits§

SyncProgress
Progress callback for sync operations.