pub struct Review {
pub repo_root: PathBuf,
pub vcs: Box<dyn Vcs>,
pub status: StatusModel,
pub session: Session,
/* private fields */
}Fields§
§repo_root: PathBuf§vcs: Box<dyn Vcs>§status: StatusModel§session: SessionThe working-tree review session, the default view.
Implementations§
Source§impl Review
impl Review
Sourcepub fn open(repo_root: &Path) -> Result<Self, ReviewError>
pub fn open(repo_root: &Path) -> Result<Self, ReviewError>
Open the git backend, load the persisted session (if any), and compute
the status sections. The working-tree review diff is deferred until
first Review::model access. Diffs carry git’s default hunk context.
Sourcepub fn open_with_context(
repo_root: &Path,
context_lines: u32,
) -> Result<Self, ReviewError>
pub fn open_with_context( repo_root: &Path, context_lines: u32, ) -> Result<Self, ReviewError>
Like Review::open with a custom number of context lines around
diff hunks (config key ui.context_lines).
Sourcepub fn model(&self) -> &DiffModel
pub fn model(&self) -> &DiffModel
The working-tree review diff, computed and cached on first access. A
backend error yields an empty diff rather than panicking; the next
Review::refresh gets another chance to compute it.
Sourcepub fn model_mut(&mut self) -> &mut DiffModel
pub fn model_mut(&mut self) -> &mut DiffModel
Mutable view of the working-tree review diff, computing it first if needed. The TUI uses this to enrich a file with intra-line emphasis just before rendering it.
Sourcepub fn refresh(&mut self) -> Result<(), ReviewError>
pub fn refresh(&mut self) -> Result<(), ReviewError>
Recompute status + diff (the watcher calls this on changes) and drop viewed marks for files that changed or left the diff.
Sourcepub fn compute_refresh(
repo_root: &Path,
context_lines: u32,
against: Option<&str>,
) -> Result<Refreshed, ReviewError>
pub fn compute_refresh( repo_root: &Path, context_lines: u32, against: Option<&str>, ) -> Result<Refreshed, ReviewError>
Compute a refresh on a separate repo handle, so it can run off the UI
thread; the result is applied later with Review::install_refresh.
against recomputes the open three-dot review in the same pass, since
it tracks edits and cannot be pinned like a commit’s diff.
Sourcepub fn compute_file(
repo_root: &Path,
rel: &str,
) -> Result<FileSnapshot, ReviewError>
pub fn compute_file( repo_root: &Path, rel: &str, ) -> Result<FileSnapshot, ReviewError>
One file’s worktree text and blame, for the file view. Opens its own
backend so it runs on a worker thread like Review::compute_refresh.
A file git cannot blame (untracked, or newly staged) still loads: it
comes back with text and no spans.
Sourcepub fn install_refresh(&mut self, status: StatusModel, model: DiffModel)
pub fn install_refresh(&mut self, status: StatusModel, model: DiffModel)
Swap in freshly computed status + diff and reconcile viewed marks.
pub fn save(&self) -> Result<(), ReviewError>
Sourcepub fn ensure_source(
&mut self,
source: &ReviewSource,
) -> Result<(), ReviewError>
pub fn ensure_source( &mut self, source: &ReviewSource, ) -> Result<(), ReviewError>
Load a non-working source’s session into the cache if not already there.
Call before reading via Review::session_for for that source.
Sourcepub fn session_for(&self, source: &ReviewSource) -> &Session
pub fn session_for(&self, source: &ReviewSource) -> &Session
The session for a source. The working tree is always present; other
sources must be Review::ensure_sourced first, else an empty session
is returned.
pub fn session_for_mut(&mut self, source: &ReviewSource) -> &mut Session
pub fn save_for(&self, source: &ReviewSource) -> Result<(), ReviewError>
Sourcepub fn all_reviews(&self) -> Result<Vec<(ReviewSource, Session)>, ReviewError>
pub fn all_reviews(&self) -> Result<Vec<(ReviewSource, Session)>, ReviewError>
Every review across all sources, in-memory state overriding disk, sorted by source key. Powers the agent-facing aggregate feed.
Sourcepub fn restore_model(&mut self, model: DiffModel)
pub fn restore_model(&mut self, model: DiffModel)
Swap a previously computed model back in. Used when a refresh proved a no-op (same fingerprint): the old model carries render-time emphasis the rebuilt one lacks.