pub struct RepoMappingManager { /* private fields */ }Implementations§
Source§impl RepoMappingManager
impl RepoMappingManager
pub fn new() -> Result<Self>
pub fn load(&self) -> Result<RepoMapping>
pub fn save(&self, mapping: &RepoMapping) -> Result<()>
Sourcepub fn load_locked(&self) -> Result<(RepoMapping, FileLock)>
pub fn load_locked(&self) -> Result<(RepoMapping, FileLock)>
Load the mapping while holding an exclusive lock.
Returns the mapping and the lock guard. The lock is released when the
guard is dropped, so callers should hold it until after save().
Use this for read-modify-write operations to prevent concurrent updates from losing changes.
Sourcepub fn resolve_url_with_details(
&self,
url: &str,
) -> Result<Option<(ResolvedUrl, Option<String>)>>
pub fn resolve_url_with_details( &self, url: &str, ) -> Result<Option<(ResolvedUrl, Option<String>)>>
Resolve a git URL with detailed resolution information.
Returns the matched URL key, resolution kind, location, and optional subpath.
Sourcepub fn resolve_url(&self, url: &str) -> Result<Option<PathBuf>>
pub fn resolve_url(&self, url: &str) -> Result<Option<PathBuf>>
Resolve a git URL to its local path.
Uses exact match first, then falls back to canonical identity matching to handle URL scheme variants (SSH vs HTTPS).
Sourcepub fn add_mapping(
&mut self,
url: String,
path: PathBuf,
auto_managed: bool,
) -> Result<()>
pub fn add_mapping( &mut self, url: String, path: PathBuf, auto_managed: bool, ) -> Result<()>
Add a URL-to-path mapping with identity-based upsert.
If a mapping with the same canonical identity already exists, it will be replaced (preserving any existing last_sync time). This prevents duplicate entries for SSH vs HTTPS variants.
Sourcepub fn remove_mapping(&mut self, url: &str) -> Result<()>
pub fn remove_mapping(&mut self, url: &str) -> Result<()>
Remove a URL mapping
Sourcepub fn is_auto_managed(&self, url: &str) -> Result<bool>
pub fn is_auto_managed(&self, url: &str) -> Result<bool>
Check if a URL is auto-managed
Sourcepub fn get_default_clone_path(url: &str) -> Result<PathBuf>
pub fn get_default_clone_path(url: &str) -> Result<PathBuf>
Get default clone path for a URL using hierarchical layout.
Returns ~/.thoughts/clones/{host}/{org_path}/{repo} with sanitized directory names.
Sourcepub fn update_sync_time(&mut self, url: &str) -> Result<()>
pub fn update_sync_time(&mut self, url: &str) -> Result<()>
Update last sync time for a URL.
Uses canonical fallback to update the correct entry even if the URL scheme differs from what’s stored.
Sourcepub fn get_canonical_key(url: &str) -> Option<RepoIdentityKey>
pub fn get_canonical_key(url: &str) -> Option<RepoIdentityKey>
Get the canonical identity key for a URL, if parseable.