vcs.VcsAdapter
The VCS surface tether relies on. Paths are relative to root.
Usage
vcs.VcsAdapter()Methods
| Name | Description |
|---|---|
| abandon() |
Drop revs from history, rebasing their descendants – except that
|
| alive_commits() | commit_alive for many commits in a bounded number of calls – |
| bookmark_delete() |
Delete the bookmark / branch name.
|
| bookmark_set() |
Create name at rev or move it there (backwards allowed).
|
| bookmarks() | Local bookmarks (jj) / branches (git): name -> commit id. |
| commit() | Commit the given paths with message; return the new commit id. |
| commit_alive() | Whether commit – or, in jj, the change it belonged to – is still |
| commit_info() | Author, timestamps, message, and parents for many commits in one call. |
| conflicted_bookmarks() | Local bookmarks with several targets (jj, after a divergent move or |
| conflicted_commits() | Visible commits whose tree holds a conflict (jj). Empty under git. |
| current_bookmarks() | The bookmarks the working copy is on. |
| current_rev() | Return the commit id of the current working-copy / HEAD commit. |
| dependants() | Visible commits built on commit other than the working copy: |
| dirty() |
Whether any of relpaths differs from the last commit (jj: @
|
| drop_bookmark() |
Make bookmark and its commits (from exclusive_commits())
|
| exclusive_commits() | Commit ids reachable from bookmark and from nothing else that |
| files_at() |
Return {root-relative path: text} for files under reldir.
|
| files_at_many() |
{rev: files_at(rev, reldir)} for several commits through one
|
| forget_workspace() |
Stop tracking the checkout at root: jj workspace forget by
|
| goto() | Return the working copy to a position() taken earlier. |
| history_digest() | A digest of every visible commit id: changes whenever any workspace |
| history_revs() | Return commit ids reachable in the repository. |
| is_ancestor() |
Whether ancestor is rev or one of its ancestors.
|
| iter_history_files() |
Yield (commit id, files_at(commit, reldir)) across all history.
|
| list_files_at() |
List tracked file paths under reldir at rev (root-relative).
|
| new() |
Move the working copy so the next commit lands on top of rev.
|
| new_bookmark() |
Start a bookmark name at rev (default: the current base) and
|
| position() | Where the working copy is, as data goto can return to. |
| read_file_at() |
Return file content at rev or None if the path is absent.
|
| refs() |
Named pointers (bookmarks / branches, tags) plus the head entry.
|
| remote_counterparts() |
Remote refs for bookmark (origin/feature, feature@origin):
|
| resolve() |
Return a stable commit id for rev.
|
| rewrite_history() |
Rewrite the files under reldir in every commit.
|
| shared_dir() | The directory every checkout of this repository shares (git’s common |
| tracked() |
Which of relpaths (files) the VCS tracks: in jj’s working-copy
|
| uncommit() | Turn commit back into working-copy changes if it is still the |
| unresolved_conflicts() | Conflicted commits that are a visible head or a working copy and |
| workspace_roots() | Root directories of every live checkout of this repository. |
abandon()
Drop revs from history, rebasing their descendants – except that
Usage
abandon(revs, keep_dir)every descendant keeps the files under keep_dir exactly as they were (snapshot, not patch, semantics: a manifest records a whole state, so a later commit’s manifest must survive the removal of an earlier one untouched instead of conflicting with it). Returns the commit ids that were abandoned and {old commit id: new commit id} for the descendants that were rebased.
jj: jj abandon then rewrite the descendants’ keep_dir files back (which also resolves the conflicts jj recorded there). git: the commits must be on the current branch and the tree clean; rebase --onto with conflicts under keep_dir resolved to the original content, then a fix-up pass so every descendant’s keep_dir matches what it held before.
alive_commits()
commit_alive for many commits in a bounded number of calls –
Usage
alive_commits(commits)status asks about every commit the op log records, and must not spawn a process per entry.
bookmark_delete()
Delete the bookmark / branch name.
Usage
bookmark_delete(name)bookmark_set()
Create name at rev or move it there (backwards allowed).
Usage
bookmark_set(name, rev)bookmarks()
Local bookmarks (jj) / branches (git): name -> commit id.
Usage
bookmarks()commit()
Commit the given paths with message; return the new commit id.
Usage
commit(relpaths, message, *, advance=None)advance names a bookmark / branch to move onto the new commit as part of the same operation (jj: one op-log entry, so jj undo takes the commit and the bookmark move back together; git: the checked-out branch moves by itself, any other is updated afterwards).
commit_alive()
Whether commit – or, in jj, the change it belonged to – is still
Usage
commit_alive(commit)part of visible history. jj resolves the commit to its change id (hidden commits still resolve) and asks whether that change is visible, so a rewrite does not count as loss; git checks reachability from any ref.
commit_info()
Author, timestamps, message, and parents for many commits in one call.
Usage
commit_info(revs)conflicted_bookmarks()
Local bookmarks with several targets (jj, after a divergent move or
Usage
conflicted_bookmarks()fetch). They are left out of bookmarks(), which has one commit per name, so the commits they reach would otherwise count as unreferenced; commands that judge references refuse while there are any. Always empty under git, whose refs have one target.
conflicted_commits()
Visible commits whose tree holds a conflict (jj). Empty under git.
Usage
conflicted_commits()current_bookmarks()
The bookmarks the working copy is on.
Usage
current_bookmarks()jj: the bookmarks at @, else – when @ is empty – at @- (the usual state right after jj new main or tether commit); several when they share a commit, as right after new_bookmark. git: the branch HEAD points at, or nothing when detached.
current_rev()
Return the commit id of the current working-copy / HEAD commit.
Usage
current_rev()dependants()
Visible commits built on commit other than the working copy:
Usage
dependants(commit)what uncommit() would rewrite. jj rebases every child of a commit it squashes away, so a bookmark’s line on top of it would be rewritten onto the parent; git’s reset --soft moves one branch and leaves the commit in place, so the answer is always empty.
dirty()
Whether any of relpaths differs from the last commit (jj: @
Usage
dirty(relpaths)vs its parent; git: index or worktree vs HEAD).
drop_bookmark()
Make bookmark and its commits (from exclusive_commits())
Usage
drop_bookmark(bookmark, commits)disappear from visible history. jj abandons the commits (which takes the bookmark with them); git deletes the branch, after which nothing reaches the commits. The working copy must not be on the bookmark.
exclusive_commits()
Commit ids reachable from bookmark and from nothing else that
Usage
exclusive_commits(bookmark)keeps a commit visible – no other local bookmark, tag, remote bookmark, or another workspace’s working copy: the line of work that leaves visible history with the bookmark. Oldest first.
files_at()
Return {root-relative path: text} for files under reldir.
Usage
files_at(rev, reldir)files_at_many()
{rev: files_at(rev, reldir)} for several commits through one
Usage
files_at_many(revs, reldir)object reader.
forget_workspace()
Stop tracking the checkout at root: jj workspace forget by
Usage
forget_workspace(root)name, or git worktree remove (a clean, non-main worktree). Returns a one-line description of what was done, or None when the VCS has nothing to forget there (git’s main worktree; an unknown path).
goto()
Return the working copy to a position() taken earlier.
Usage
goto(position)jj: edit the change if it still exists, or start a fresh empty change on its parent when the recorded working copy was empty (jj abandons those when the working copy moves away). git: switch to the branch, or detach at the commit.
history_digest()
A digest of every visible commit id: changes whenever any workspace
Usage
history_digest()or bookmark of this repository gains or loses a commit. Plans whose safety rests on what history references (gc) bind to it.
history_revs()
Return commit ids reachable in the repository.
Usage
history_revs()is_ancestor()
Whether ancestor is rev or one of its ancestors.
Usage
is_ancestor(ancestor, rev)iter_history_files()
Yield (commit id, files_at(commit, reldir)) across all history.
Usage
iter_history_files(reldir)A conflicted jj commit is yielded once per input of the conflict – every side and base of its tree – and last with the tree jj shows for it, so a walk that collects references sees every manifest the conflict may resolve to, and one that keeps a single answer per commit keeps the same one as before.
Implementations stream through one object-reader process rather than spawning per commit; callers should consume lazily.
list_files_at()
List tracked file paths under reldir at rev (root-relative).
Usage
list_files_at(rev, reldir)new()
Move the working copy so the next commit lands on top of rev.
Usage
new(rev)jj: jj new REV (a fresh empty change; None means on top of the current one). git has no empty-commit primitive: a branch name is switched to; any other revision is checked out onto a new branch tether/<rev12> so the commits that follow stay reachable (a detached HEAD would let gc treat them as gone); None is a no-op – the next commit lands on the current branch.
new_bookmark()
Start a bookmark name at rev (default: the current base) and
Usage
new_bookmark(name, rev)move the working copy onto it.
jj: jj new REV then the bookmark at @-. git: switch -c NAME [REV].
position()
Where the working copy is, as data goto can return to.
Usage
position()read_file_at()
Return file content at rev or None if the path is absent.
Usage
read_file_at(rev, relpath)remote_counterparts()
Remote refs for bookmark (origin/feature, feature@origin):
Usage
remote_counterparts(bookmark)what still reaches its commits after a local drop, and what a later push deletes (jj) or leaves (git).
resolve()
Return a stable commit id for rev.
Usage
resolve(rev)rewrite_history()
Rewrite the files under reldir in every commit.
Usage
rewrite_history(reldir, transform, *, ignore_immutable=False)transform(commit, files) receives {root-relative path: text} and returns the texts that should be there instead (same keys; a commit whose result equals its input is left alone, but still gets a new id if a parent changed). Descendants are rebased, bookmarks / branches and tags follow, change ids (jj) are preserved. Returns {old commit id: new commit id} for every commit that changed. The working-copy commit is not rewritten (edit the working tree instead); the working copy ends where it started.
This is history rewriting: every other clone must re-sync. ignore_immutable (jj) rewrites commits jj considers immutable.
tracked()
Which of relpaths (files) the VCS tracks: in jj’s working-copy
Usage
tracked(relpaths, *, checkout=None)commit as last snapshotted, in git’s index. One call and no snapshot, so Repo.find can afford it on every run: a per-checkout file the VCS tracks came with a clone (or was committed by hand) and is refused. checkout asks another checkout of this repository (a root from workspace_roots), with relpaths relative to it.
uncommit()
Turn commit back into working-copy changes if it is still the
Usage
uncommit(commit)working copy’s parent (jj) / HEAD (git); False if it is not.
jj: jj squash --from COMMIT --into @; git: git reset --soft. The tree is unchanged either way – the commit’s edits stay in the working copy as uncommitted changes.
unresolved_conflicts()
Conflicted commits that are a visible head or a working copy and
Usage
unresolved_conflicts(reldir)whose conflict touches reldir (jj). A descendant inherits a conflict until it resolves it, so a conflict no later commit resolved always shows at a head, and one resolved in a child (or further down) does not – wherever the bookmarks are. Empty under git.
workspace_roots()
Root directories of every live checkout of this repository.
Usage
workspace_roots()jj workspaces (jj workspace list + jj workspace root --name) or git worktrees (git worktree list). Used by gc --prune-bookmarks to keep the working branches of workspaces that still exist.
References
refs()
Named pointers (bookmarks / branches, tags) plus the head entry.
Usage
refs()