pub struct JjVcs { /* private fields */ }Implementations§
Source§impl JjVcs
impl JjVcs
pub fn open_with_settings( root: &Path, settings: &DiffSettings, ) -> Result<Self, VcsError>
Trait Implementations§
Source§impl Vcs for JjVcs
impl Vcs for JjVcs
Source§fn status(&self) -> Result<StatusModel, VcsError>
fn status(&self) -> Result<StatusModel, VcsError>
Built from working_tree_diff (@- vs the whole working copy in one
diff pass): jj’s snapshot marks a new file intent-to-add in the
colocated index, so merging git’s own untracked/unstaged/staged lists
would double-count it, git2 reporting it once as added (tree vs
index) and again as modified (index vs workdir).
Source§fn commit(&self, message: &str) -> Result<String, VcsError>
fn commit(&self, message: &str) -> Result<String, VcsError>
Messages go as --message=<text>: clap reads a separate value that
starts with - as a flag.
Source§fn amend(
&self,
message: Option<&str>,
use_index: bool,
) -> Result<String, VcsError>
fn amend( &self, message: Option<&str>, use_index: bool, ) -> Result<String, VcsError>
message: None folds the working copy into its parent, keeping the
parent’s description (jj squash -u: a bare squash opens an editor
when both sides are described); Some with use_index folds and
sets the new description in the same squash; Some without
use_index rewords the parent alone (jj describe), leaving the
working copy untouched.
Source§fn create_branch(&self, name: &str, _checkout: bool) -> Result<(), VcsError>
fn create_branch(&self, name: &str, _checkout: bool) -> Result<(), VcsError>
Labels the current change (@) with a bookmark; checkout is a
no-op since @ is already where the reader is standing.
Source§fn delete_branch(&self, name: &str) -> Result<(), VcsError>
fn delete_branch(&self, name: &str) -> Result<(), VcsError>
exact:, since jj reads a bare name as a glob.
Source§fn checkout(&self, name: &str) -> Result<(), VcsError>
fn checkout(&self, name: &str) -> Result<(), VcsError>
jj new <rev> keeps working on top of the branch; jj edit edits
its tip commit in place. jj new never discards the change being
left behind, only detaches it.
Source§fn has_index(&self) -> bool
fn has_index(&self) -> bool
StatusModel::staged and
the UI drops staging entirely.Source§fn native_git_checkout(&self) -> bool
fn native_git_checkout(&self) -> bool
git/forge CLI command (git switch, gh pr checkout)
may check out a branch directly: true for plain git; jj’s own
operation log and working-copy snapshot would never see a write made
this way, so a checkout there must go through Vcs::checkout instead.Source§fn git_dir(&self) -> Result<PathBuf, VcsError>
fn git_dir(&self) -> Result<PathBuf, VcsError>
<root>/.git; in a linked worktree <root>/.git is a gitlink file
and this resolves to the external gitdir it points at.Source§fn working_tree_diff(&self) -> Result<DiffModel, VcsError>
fn working_tree_diff(&self) -> Result<DiffModel, VcsError>
Source§fn tree_to_workdir_diff(&self, base_oid: &str) -> Result<DiffModel, VcsError>
fn tree_to_workdir_diff(&self, base_oid: &str) -> Result<DiffModel, VcsError>
Vcs::working_tree_diff taken from an arbitrary base commit instead
of HEAD, so uncommitted work shows alongside the commits since base.Source§fn commit_diff(&self, oid: &str) -> Result<DiffModel, VcsError>
fn commit_diff(&self, oid: &str) -> Result<DiffModel, VcsError>
Source§fn range_diff(
&self,
oldest_oid: &str,
newest_oid: &str,
) -> Result<DiffModel, VcsError>
fn range_diff( &self, oldest_oid: &str, newest_oid: &str, ) -> Result<DiffModel, VcsError>
oldest to newest (git diff <oldest>^..<newest> semantics). When
oldest is a root commit its first-parent tree is the empty tree, so
the range includes everything oldest introduced.Source§fn tree_diff(
&self,
base_oid: &str,
newest_oid: &str,
) -> Result<DiffModel, VcsError>
fn tree_diff( &self, base_oid: &str, newest_oid: &str, ) -> Result<DiffModel, VcsError>
git diff <base> <newest> semantics);
with base a merge base this is a PR-style three-dot diff.Source§fn merge_base(&self, a: &str, b: &str) -> Result<String, VcsError>
fn merge_base(&self, a: &str, b: &str) -> Result<String, VcsError>
Source§fn resolve(&self, revision: &str) -> Result<String, VcsError>
fn resolve(&self, revision: &str) -> Result<String, VcsError>
Source§fn log(&self, limit: usize) -> Result<Vec<LogEntry>, VcsError>
fn log(&self, limit: usize) -> Result<Vec<LogEntry>, VcsError>
Source§fn default_branch(&self, remote: &str) -> Result<Option<String>, VcsError>
fn default_branch(&self, remote: &str) -> Result<Option<String>, VcsError>
None when the
repository offers no answer.Source§fn commits_between(
&self,
base: &str,
head: &str,
) -> Result<Vec<LogEntry>, VcsError>
fn commits_between( &self, base: &str, head: &str, ) -> Result<Vec<LogEntry>, VcsError>
head but not base, newest first: what a
pull request from head would carry.Source§fn unpushed(&self, limit: usize) -> Result<Option<Vec<LogEntry>>, VcsError>
fn unpushed(&self, limit: usize) -> Result<Option<Vec<LogEntry>>, VcsError>
limit of them: work that exists only on this machine. None
when the repository has no remote-tracking refs, where being pushed has
no meaning yet. Asking the remotes rather than the configured upstream
is what makes the answer true: an upstream may be another local branch,
or a stale ref from before the last fetch. limit bounds a walk that is
otherwise the whole history whenever no remote ref sits on it.Source§fn blame(&self, rel: &Path) -> Result<Vec<BlameSpan>, VcsError>
fn blame(&self, rel: &Path) -> Result<Vec<BlameSpan>, VcsError>
rel as the worktree has it, in line
order. Lines the worktree added since the last commit come back as one
span of their own, owned by no commit.Source§fn read_at(&self, rev: &str, path: &str) -> Result<Option<String>, VcsError>
fn read_at(&self, rev: &str, path: &str) -> Result<Option<String>, VcsError>
rev’s tree, None when that tree
has no such path. Lets a review pinned to one tree (a commit, a
range’s newest, a PR’s head) resolve a walkthrough’s anchors against
what it actually shows, rather than whatever the worktree holds now.Source§fn read_blob(&self, oid: &str) -> Result<Option<Vec<u8>>, VcsError>
fn read_blob(&self, oid: &str) -> Result<Option<Vec<u8>>, VcsError>
crate::model::BlobIds side),
None when the object store has no such blob.Source§fn tracked_files(&self) -> Result<Vec<PathBuf>, VcsError>
fn tracked_files(&self) -> Result<Vec<PathBuf>, VcsError>
Source§fn attr(&self, rel: &Path, name: &str) -> bool
fn attr(&self, rel: &Path, name: &str) -> bool
name to true for rel.
Unreadable attribute files read as unset: the caller is refining a
guess, so there is nothing to report and nothing to recover.Source§fn branches(&self) -> Result<Vec<BranchInfo>, VcsError>
fn branches(&self) -> Result<Vec<BranchInfo>, VcsError>
Source§fn divergence(&self, branch: &str) -> Result<Option<(usize, usize)>, VcsError>
fn divergence(&self, branch: &str) -> Result<Option<(usize, usize)>, VcsError>
branch stands from its upstream, as (ahead, behind), or
None when it tracks nothing.Source§fn all_branches(&self) -> Result<Vec<String>, VcsError>
fn all_branches(&self) -> Result<Vec<String>, VcsError>
Source§fn stage(&self, _rel: &Path) -> Result<(), VcsError>
fn stage(&self, _rel: &Path) -> Result<(), VcsError>
Source§fn stage_everything(&self) -> Result<(), VcsError>
fn stage_everything(&self) -> Result<(), VcsError>
Source§fn unstage_everything(&self) -> Result<(), VcsError>
fn unstage_everything(&self) -> Result<(), VcsError>
Source§fn stage_hunk(&self, _rel: &Path, _hunk: &HunkId) -> Result<(), VcsError>
fn stage_hunk(&self, _rel: &Path, _hunk: &HunkId) -> Result<(), VcsError>
Source§fn unstage(&self, _rel: &Path) -> Result<(), VcsError>
fn unstage(&self, _rel: &Path) -> Result<(), VcsError>
Source§fn unstage_hunk(&self, _rel: &Path, _hunk: &HunkId) -> Result<(), VcsError>
fn unstage_hunk(&self, _rel: &Path, _hunk: &HunkId) -> Result<(), VcsError>
Source§fn discard(&self, rel: &Path) -> Result<(), VcsError>
fn discard(&self, rel: &Path) -> Result<(), VcsError>
Source§fn head_message(&self) -> Result<String, VcsError>
fn head_message(&self) -> Result<String, VcsError>
Source§fn stash_push(&self, _message: Option<&str>) -> Result<(), VcsError>
fn stash_push(&self, _message: Option<&str>) -> Result<(), VcsError>
git stash. message
None lets the backend label it. Local-only: no network.Source§fn stash_pop(&self) -> Result<(), VcsError>
fn stash_pop(&self) -> Result<(), VcsError>
Source§fn network_argv(&self, op: NetworkOp) -> Result<Vec<String>, VcsError>
fn network_argv(&self, op: NetworkOp) -> Result<Vec<String>, VcsError>
["git", "push"]. The binary runs
this in Vcs::workdir so the backend’s own CLI handles credentials;
diffler never touches them. The jj backend returns ["jj", "git", …]
for a fetch; push and pull would move git’s refs behind jj’s back, so
it rejects every push/pull variant instead.Source§fn remote_url(&self, name: &str) -> Result<Option<String>, VcsError>
fn remote_url(&self, name: &str) -> Result<Option<String>, VcsError>
origin), if it exists. Used to detect the
CI provider’s host without shelling out.Source§fn remotes(&self) -> Result<Vec<String>, VcsError>
fn remotes(&self) -> Result<Vec<String>, VcsError>
Source§fn set_diff_algorithm(&self, algorithm: DiffAlgorithm, indent_heuristic: bool)
fn set_diff_algorithm(&self, algorithm: DiffAlgorithm, indent_heuristic: bool)
diff.algorithm, diff.indent_heuristic).