|Git::Raw::Diff(3pm)||User Contributed Perl Documentation||Git::Raw::Diff(3pm)|
NAME¶Git::Raw::Diff - Git diff class
DESCRIPTION¶A Git::Raw::Diff represents the diff between two entities.
WARNING: The API of this module is unstable and may change without warning (any change will be appropriately documented in the changelog).
new( $buffer )¶Create a diff from the content of a git patch.
patchid( )¶Calculate the patch id.
merge( $from )¶Merge the given diff with the Git::Raw::Diff $from.
buffer( $format )¶Get the content of a diff as text. See "Git::Raw::Diff->print()" for valid $format values.
delta_count( )¶Query how many diff records there are in the diff.
deltas( [$index] )¶Returns a list of Git::Raw::Diff::Delta objects. If $index is specified only the delta at the specified index will be returned.
find_similar( [\%options] )¶Transform the diff marking file renames, copies, etc. Valid fields for the %options hash include:
Flags for finding similar files. Valid values include:
Look for renames.
Consider old side of modifies files for renames.
Look for copies.
Consider unmodified files as copy sources.
Mark significant rewrites for split.
Actually split large rewrites into delete/add pairs.
Find renames/copies for untracked items in the working directory.
Turn on all finding features.
Measure similarity ignoring leading whitespace (default).
Measure similarity ignoring all whitespace.
Measure similarity including all data.
Measure similarity only by comparing SHAs (fast and cheap).
Do not break rewrites unless they contribute to a rename.
Remove any unmodified deltas after "find_similar" is done.
Similarity to consider a file renamed (default 50).
Similarity of modified to be eligible rename source (default 50).
Similarity to consider a file a copy (default 50).
Similarity to split modify into delete/add pair (default 60).
Maximum similarity sources to examine for a file (default 200).
patches( )¶Return a list of Git::Raw::Patch objects for the diff.
print( $format, $callback )¶Generate text output from the diff object. The $callback will be called for each line of the diff with two arguments: the first one represents the type of the patch line ("ctx" for context lines, "add" for additions, "del" for deletions, "file" for file headers, "hunk" for hunk headers, "bin" for binary data or "noeol" if both files have no LF at end) and the second argument contains the content of the patch line.
The $format can be one of the following:
Full git diff.
Only the file headers of the diff.
Like "git diff --raw".
Like "git diff --name-only".
Like "git diff --name-status".
stats( )¶Accumlated diff statistics for all patches in the diff. Returns a Git::Raw::Diff::Stats object.
AUTHOR¶Alessandro Ghedini <email@example.com>
Jacques Germishuys <firstname.lastname@example.org>
LICENSE AND COPYRIGHT¶Copyright 2012 Alessandro Ghedini.
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.