Struct git2::Diff
[−]
[src]
pub struct Diff { // some fields omitted }
The diff object that contains all individual file deltas.
This is an opaque structure which will be allocated by one of the diff
generator functions on the Repository
structure (e.g. diff_tree_to_tree
or other diff_*
functions).
Methods
impl Diff
[src]
fn merge(&mut self, from: &Diff) -> Result<(), Error>
Merge one diff into another.
This merges items from the "from" list into the "self" list. The resulting diff will have all items that appear in either list. If an item appears in both lists, then it will be "merged" to appear as if the old version was from the "onto" list and the new version is from the "from" list (with the exception that if the item has a pending DELETE in the middle, then it will show as deleted).
fn deltas(&self) -> Deltas
Returns an iterator over the deltas in this diff.
fn get_delta(&self, i: usize) -> Option<DiffDelta>
Return the diff delta for an entry in the diff list.
fn is_sorted_icase(&self) -> bool
Check if deltas are sorted case sensitively or insensitively.
fn print<F>(&self, format: DiffFormat, cb: F) -> Result<(), Error> where F: FnMut(DiffDelta, Option<DiffHunk>, DiffLine) -> bool
Iterate over a diff generating formatted text output.
Returning false
from the callback will terminate the iteration and
return an error from this function.
fn stats(&self) -> Result<DiffStats, Error>
Accumulate diff statistics for all patches.
fn find_similar(&mut self, opts: Option<&mut DiffFindOptions>) -> Result<(), Error>
Transform a diff marking file renames, copies, etc.
This modifies a diff in place, replacing old entries that look like renames or copies with new entries reflecting those changes. This also will, if requested, break modified files into add/remove pairs if the amount of change is above a threshold.