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.
Implementations§
Source§impl Review
impl Review
pub fn open(repo_root: &Path) -> Result<Self, ReviewError>
pub fn open_with_settings( repo_root: &Path, settings: &DiffSettings, ) -> Result<Self, ReviewError>
pub fn set_diff_algorithm( &self, algorithm: DiffAlgorithm, indent_heuristic: bool, )
Sourcepub fn model(&self) -> &DiffModel
pub fn model(&self) -> &DiffModel
The working-tree diff, cached on first access. A backend error caches
an empty diff until the next Review::refresh.
pub fn model_mut(&mut self) -> &mut DiffModel
Sourcepub fn refresh(&mut self) -> Result<(), ReviewError>
pub fn refresh(&mut self) -> Result<(), ReviewError>
Recompute status and diff, and drop viewed marks for files that changed or left the diff.
Sourcepub fn compute_refresh(
repo_root: &Path,
settings: &DiffSettings,
against: Option<&str>,
pinned: Option<(&ReviewSource, Option<(&str, &str)>)>,
) -> Result<Refreshed, ReviewError>
pub fn compute_refresh( repo_root: &Path, settings: &DiffSettings, against: Option<&str>, pinned: Option<(&ReviewSource, Option<(&str, &str)>)>, ) -> Result<Refreshed, ReviewError>
A refresh on its own repo handle, for a worker thread; apply it with
Review::install_refresh. against and pinned re-diff the open
three-dot or pinned source in the same pass.
Sourcepub fn compute_declared(
repo_root: &Path,
paths: &[String],
) -> Result<HashMap<String, Kind>, ReviewError>
pub fn compute_declared( repo_root: &Path, paths: &[String], ) -> Result<HashMap<String, Kind>, ReviewError>
What the repo’s git attributes declare about each of paths, leaving
out paths they say nothing about. Each lookup is real IO, so we run
this on a worker.
Sourcepub fn compute_walkthrough_files(
repo_root: &Path,
rev: Option<&str>,
read_first: ReadFirst,
files: &[String],
) -> WalkthroughFiles
pub fn compute_walkthrough_files( repo_root: &Path, rev: Option<&str>, read_first: ReadFirst, files: &[String], ) -> WalkthroughFiles
Every requested file’s content from the copy read_first names, else
the other. A path neither copy has is left out. Runs on a worker.
Sourcepub fn compute_binary_sides(
repo_root: &Path,
path: &str,
blobs: &BlobIds,
deleted: bool,
) -> BinarySides
pub fn compute_binary_sides( repo_root: &Path, path: &str, blobs: &BlobIds, deleted: bool, ) -> BinarySides
Both sides of a binary file, each from its blob, the new side from the
worktree when the store has no blob for it. We check the size first so
a side over MAX_PREVIEW_BYTES never loads into memory.
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 a worker. A file git cannot blame comes back with no spans.
pub fn install_refresh(&mut self, status: StatusModel, model: DiffModel)
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 source’s session into the cache. Call before
Review::session_for.
Sourcepub fn session_for(&self, source: &ReviewSource) -> &Session
pub fn session_for(&self, source: &ReviewSource) -> &Session
Empty for a source not yet Review::ensure_sourced.
pub fn session_for_mut(&mut self, source: &ReviewSource) -> &mut Session
pub fn save_for(&self, source: &ReviewSource) -> Result<(), ReviewError>
Sourcepub fn forget_source(&mut self, source: &ReviewSource)
pub fn forget_source(&mut self, source: &ReviewSource)
Drop a source’s cached session once its file is deleted, so a later access reloads it.
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. A review file that fails to parse is skipped.
Sourcepub fn all_reviews_and_corrupt(&self) -> Result<LoadedReviews, ReviewError>
pub fn all_reviews_and_corrupt(&self) -> Result<LoadedReviews, ReviewError>
Review::all_reviews plus the path of every review file skipped.
Sourcepub fn restore_model(&mut self, model: DiffModel)
pub fn restore_model(&mut self, model: DiffModel)
Swap a previous model back in after a no-op refresh, since it carries render-time emphasis the rebuilt one lacks.