.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.42) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Arch::DiffParser 3pm" .TH Arch::DiffParser 3pm "2022-06-08" "perl v5.34.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Arch::DiffParser \- parse file's diff and perform some manipulations .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 2 \& use Arch::DiffParser; \& my $dp = Arch::DiffParser\->new; \& \& # usable for "annotate" functionality \& my $changes = $dp\->parse_file("f.diff")\->changes; \& \& $dp\->parse($diff_content); \& $dp\->parse("\-\-\- f1.c\et2005\-02\-26\en+++ f2.c\et2005\-02\-28\en..."); \& # prints "f1.c, f2.c" \& printf "%s, %s\en", $dp\->filename1, $dp\->filename2; \& \& # enclose lines in \& my $html = $dp\->markup_content; .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" This class provides a limited functionality to parse a single file diff in unified format. Multiple diffs may be parsed sequentially. The parsed data is stored for the last diff, and is replaced on the following parse. .SH "METHODS" .IX Header "METHODS" The following class methods are available: .PP \&\fBnew\fR, \&\fBparse\fR, \&\fBparse_file\fR, \&\fBcontent\fR, \&\fBlines\fR, \&\fBfilename1\fR, \&\fBfilename2\fR, \&\fBmtime1\fR, \&\fBmtime2\fR, \&\fBhunks\fR, \&\fBchanges\fR. .IP "\fBnew\fR" 4 .IX Item "new" Construct the \f(CW\*(C`Arch::DiffParser\*(C'\fR instanse. .IP "\fBparse\fR \fIdiff_content\fR" 4 .IX Item "parse diff_content" Parse the \fIdiff_content\fR and store its parsed data. .IP "\fBparse_file\fR \fIdiff_filename\fR" 4 .IX Item "parse_file diff_filename" Like \fBparse\fR, but read the \fIdiff_content\fR from \fIdiff_filename\fR. .IP "\fBdiff_data\fR" 4 .IX Item "diff_data" Return hashref containing certain parsed data. Die if called before any \fBparse\fR methods. The keys are: \&\*(L"lines\*(R", \&\*(L"filename1\*(R", \&\*(L"filename2\*(R", \&\*(L"mtime1\*(R", \&\*(L"mtime2\*(R", \&\*(L"hunks\*(R", \&\*(L"changes\*(R". .Sp The value of \*(L"hunks\*(R" and \*(L"changes\*(R" is arrayref of arrayrefs with 5 elements: [ line\-number\-1, num\-lines\-1, line\-number\-2, num\-lines\-2, \*(L"lines\*(R"\-index ]. .Sp A \*(L"hunk\*(R" describes a set of lines containing some combination of unmodified, deleted and added lines, a \*(L"change\*(R" describes an inter-hunk atom that only contains zero or more deleted lines and zero or more added lines. .IP "\fBlines\fR" 4 .IX Item "lines" .PD 0 .IP "\fBfilename1\fR" 4 .IX Item "filename1" .IP "\fBfilename2\fR" 4 .IX Item "filename2" .IP "\fBmtime1\fR" 4 .IX Item "mtime1" .IP "\fBmtime2\fR" 4 .IX Item "mtime2" .IP "\fBhunks\fR" 4 .IX Item "hunks" .IP "\fBchanges\fR" 4 .IX Item "changes" .PD These methods are just shortcuts for \fBdiff_data\fR\->{\fImethod\fR}. .IP "\fBcontent\fR [\fI\f(CI%args\fI\fR]" 4 .IX Item "content [%args]" Return content of the last diff. .Sp \&\fI\f(CI%args\fI\fR keys are \*(L"fileroot1\*(R" and \*(L"fileroot2\*(R"; if given, these will replace the subdirs \*(L"orig\*(R" and \*(L"mod\*(R" that arch usually uses in the filepaths. .IP "\fBmarkup_content\fR [\fI\f(CI%args\fI\fR]" 4 .IX Item "markup_content [%args]" Like \fBcontent\fR, but every non-context line is enclosed into markup line, where \fIname\fR is one of \*(L"orig\*(R" (filename1), \*(L"mod\*(R" (filename2), \*(L"line\*(R" (hunk linenums), \&\*(L"add\*(R" (added), del (deleted). .Sp Not implemented yet. .SH "BUGS" .IX Header "BUGS" No support for newlines in source file names yet. .SH "AUTHORS" .IX Header "AUTHORS" Mikhael Goikhman (migo@homemail.com\*(--Perl\-GPL/arch\-perl\*(--devel). .SH "SEE ALSO" .IX Header "SEE ALSO" For more information, see Text::Diff::Unified, Algorithm::Diff.