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.
Auto Trait Implementations§
impl Freeze for RepoMappingManager
impl RefUnwindSafe for RepoMappingManager
impl Send for RepoMappingManager
impl Sync for RepoMappingManager
impl Unpin for RepoMappingManager
impl UnwindSafe for RepoMappingManager
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
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>
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>
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