pub struct Repo<R: ProcessRunner = JobRunner> { /* private fields */ }Expand description
Implementations§
Source§impl<R: ProcessRunner> Repo<R>
impl<R: ProcessRunner> Repo<R>
Sourcepub fn from_git(
root: impl Into<PathBuf>,
cwd: impl Into<PathBuf>,
client: Git<R>,
) -> Self
pub fn from_git( root: impl Into<PathBuf>, cwd: impl Into<PathBuf>, client: Git<R>, ) -> Self
Build a git-backed handle from an explicit client — for a custom runner
(e.g. a test seam) or a pre-configured Git.
Sourcepub fn from_jj(
root: impl Into<PathBuf>,
cwd: impl Into<PathBuf>,
client: Jj<R>,
) -> Self
pub fn from_jj( root: impl Into<PathBuf>, cwd: impl Into<PathBuf>, client: Jj<R>, ) -> Self
Build a jj-backed handle from an explicit client.
Sourcepub fn kind(&self) -> BackendKind
pub fn kind(&self) -> BackendKind
Which backend drives this handle.
Sourcepub fn at(&self, dir: impl Into<PathBuf>) -> Self
pub fn at(&self, dir: impl Into<PathBuf>) -> Self
A sibling handle bound to dir, sharing this handle’s client and root.
Sourcepub fn git(&self) -> Option<&Git<R>>
pub fn git(&self) -> Option<&Git<R>>
The underlying Git client, or None when jj-backed — an escape hatch
to git-only operations not on the common surface.
Sourcepub async fn current_branch(&self) -> Result<Option<String>>
pub async fn current_branch(&self) -> Result<Option<String>>
The current branch (git) or bookmark (jj); None when detached / no
bookmark on the working copy.
Sourcepub async fn trunk(&self) -> Result<Option<String>>
pub async fn trunk(&self) -> Result<Option<String>>
The trunk branch/bookmark; None when it can’t be resolved.
Sourcepub async fn local_branches(&self) -> Result<Vec<String>>
pub async fn local_branches(&self) -> Result<Vec<String>>
Local branch (git) / bookmark (jj) names.
Sourcepub async fn branch_exists(&self, name: &str) -> Result<bool>
pub async fn branch_exists(&self, name: &str) -> Result<bool>
Whether a local branch/bookmark named name exists.
Sourcepub async fn has_uncommitted_changes(&self) -> Result<bool>
pub async fn has_uncommitted_changes(&self) -> Result<bool>
Whether the working copy has uncommitted changes (git: a non-empty
status; jj: a non-empty working-copy change @).
Sourcepub async fn delete_branch(&self, name: &str, force: bool) -> Result<()>
pub async fn delete_branch(&self, name: &str, force: bool) -> Result<()>
Delete a local branch (git) / bookmark (jj). force applies to git only
(branch -D vs -d); jj has no force and ignores it.
Sourcepub async fn rename_branch(&self, old: &str, new: &str) -> Result<()>
pub async fn rename_branch(&self, old: &str, new: &str) -> Result<()>
Rename a local branch (git) / bookmark (jj).
Sourcepub async fn changed_files(&self) -> Result<Vec<FileChange>>
pub async fn changed_files(&self) -> Result<Vec<FileChange>>
The working-copy changes (git status / jj diff -r @ --summary).
Sourcepub async fn diff_stat(&self) -> Result<DiffStat>
pub async fn diff_stat(&self) -> Result<DiffStat>
Aggregate insertion/deletion counts for the working copy.
Sourcepub async fn commit_paths(&self, paths: &[String], message: &str) -> Result<()>
pub async fn commit_paths(&self, paths: &[String], message: &str) -> Result<()>
Commit exactly paths with message (git commit --only, jj
commit <filesets>). Paths are repo-relative.
Sourcepub async fn fetch(&self) -> Result<()>
pub async fn fetch(&self) -> Result<()>
Fetch from the default remote (git fetch / jj git fetch).
Sourcepub async fn list_worktrees(&self) -> Result<Vec<WorktreeInfo>>
pub async fn list_worktrees(&self) -> Result<Vec<WorktreeInfo>>
List attached worktrees (git) / workspaces (jj).
Sourcepub async fn create_worktree(
&self,
path: &Path,
branch: &str,
base: &str,
) -> Result<CreateOutcome>
pub async fn create_worktree( &self, path: &Path, branch: &str, base: &str, ) -> Result<CreateOutcome>
Create a worktree/workspace at path on a new branch based on
base. Always CreateOutcome::Plain; a copy-on-write strategy stays in
the consumer.
branch must not already exist. The jj path is two steps (workspace add
then bookmark create) and is not atomic: if the bookmark step fails, the
freshly-added workspace is left in place for the caller to clean up. A
consumer needing resume-existing or rollback semantics should drive the
underlying client via jj / git.