NAME
VCI::Abstract::Diff - An object representing a "diff" or "patch" from a Version-Control System
SYNOPSIS
my $diff = $commit->as_diff;
my $file_changes = $diff->files;
foreach my $file (@$files) {
my $changes = $file->changes;
my $path = $file->path;
}
my $text = $diff->raw;
DESCRIPTION
Every VCS can generate a patch in "diff" format that can be applied to re-create the changes in a particular commit.
This class represents the actual changes made to each file in a commit, and can also be represented in "diff" format.
METHODS
Accessors
All accessors are read-only.
files
-
An arrayref of VCI::Abstract::Diff::File objects, which each represent the changes made to that particular file.
Files that were added but have no contents aren't tracked in the Diff.
Note that changes to binary files aren't tracked.
raw
-
The exact text of the diff, as it would be returned by the version-control system. If will be in unified diff format, but other details of the format of the patch may be specific to the VCS.
project
-
The VCI::Abstract::Project that this Diff is from.
For Subclass Implementors
If you are just a user of VCI::Abstract::Diff, you don't need to read about these.
_transform_filename
-
To make implementing this class easier, you can override this function to transform the filenames that appear in the patch into filenames relative to the root of your Project.
CLASS METHODS
Constructor
Usually you won't construct an instance of this class directly, but instead, use "as_diff" in VCI::Abstract::Commit.
new
-
Takes all "Accessors" as named parameters. The following fields are required: "raw", and "project".