first pass of merging in warp (doesn't build)

This commit is contained in:
Ryan Ward
2026-07-01 16:08:58 -05:00
parent 2f64909469
commit 4770ac06b5
3662 changed files with 414574 additions and 89772 deletions
@@ -1,6 +1,7 @@
use std::path::{Path, PathBuf};
use galaxy_core::HostId;
use galaxy_util::local_or_remote_path::LocalOrRemotePath;
use galaxy_util::remote_path::RemotePath;
use galaxy_util::standardized_path::StandardizedPath;
/// Identifies a repository across local and remote environments.
@@ -8,10 +9,13 @@ use galaxy_util::standardized_path::StandardizedPath;
pub enum RepositoryIdentifier {
/// A repository on the local filesystem, identified by its standardized path.
Local(StandardizedPath),
/// A repository on a remote server, identified by session + path.
Remote(RemoteRepositoryIdentifier),
/// A repository on a remote server, identified by host + path.
Remote(RemotePath),
}
/// Type alias preserved for backward compatibility.
pub type RemoteRepositoryIdentifier = RemotePath;
impl RepositoryIdentifier {
/// Convenience constructor for a local repository identifier.
pub fn local(path: StandardizedPath) -> Self {
@@ -41,28 +45,21 @@ impl RepositoryIdentifier {
Self::Remote(_) => None,
}
}
}
/// Identifies a repository on a remote server.
///
/// Pairs a [`HostId`] (to deduplicate across multiple SSH sessions to the
/// same host) with the server-side [`StandardizedPath`]. The path lives on
/// the remote machine and is constructed without I/O using encoding
/// information from the remote OS.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct RemoteRepositoryIdentifier {
pub host_id: HostId,
pub path: StandardizedPath,
}
impl RemoteRepositoryIdentifier {
pub fn new(host_id: HostId, path: StandardizedPath) -> Self {
Self { host_id, path }
/// Converts this identifier to a `LocalOrRemotePath`.
///
/// Returns `None` only for `Local` identifiers whose `StandardizedPath`
/// cannot be converted to a local `PathBuf` (cross-platform edge case).
pub fn to_local_or_remote_path(&self) -> Option<LocalOrRemotePath> {
match self {
Self::Local(path) => path.to_local_path().map(LocalOrRemotePath::Local),
Self::Remote(remote) => Some(LocalOrRemotePath::Remote(remote.clone())),
}
}
}
impl From<RemoteRepositoryIdentifier> for RepositoryIdentifier {
fn from(id: RemoteRepositoryIdentifier) -> Self {
impl From<RemotePath> for RepositoryIdentifier {
fn from(id: RemotePath) -> Self {
Self::Remote(id)
}
}