Blame diffstat.1

Packit bef1e6
.\"*****************************************************************************
Packit bef1e6
.\" Copyright 1994-2014,2016 by Thomas E. Dickey                               *
Packit bef1e6
.\" All Rights Reserved.                                                       *
Packit bef1e6
.\"                                                                            *
Packit bef1e6
.\" Permission to use, copy, modify, and distribute this software and its      *
Packit bef1e6
.\" documentation for any purpose and without fee is hereby granted, provided  *
Packit bef1e6
.\" that the above copyright notice appear in all copies and that both that    *
Packit bef1e6
.\" copyright notice and this permission notice appear in supporting           *
Packit bef1e6
.\" documentation, and that the name of the above listed copyright holder(s)   *
Packit bef1e6
.\" not be used in advertising or publicity pertaining to distribution of the  *
Packit bef1e6
.\" software without specific, written prior permission.                       *
Packit bef1e6
.\"                                                                            *
Packit bef1e6
.\" THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD   *
Packit bef1e6
.\" TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND  *
Packit bef1e6
.\" FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE  *
Packit bef1e6
.\" FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES          *
Packit bef1e6
.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN      *
Packit bef1e6
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR *
Packit bef1e6
.\" IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.                *
Packit bef1e6
.\"*****************************************************************************
Packit bef1e6
.\" $Id: diffstat.1,v 1.35 2016/01/14 09:39:26 tom Exp $
Packit bef1e6
.TH DIFFSTAT 1
Packit bef1e6
.SH NAME
Packit bef1e6
\fBdiffstat\fP \- make histogram from diff-output
Packit bef1e6
.SH SYNOPSIS
Packit bef1e6
\fBdiffstat\fP\fI [options] [file-specifications]\fP
Packit bef1e6
.SH DESCRIPTION
Packit bef1e6
This program reads the output of \fBdiff\fP and displays a histogram
Packit bef1e6
of the insertions, deletions, and modifications per-file.
Packit bef1e6
\fBDiffstat\fP is a program that is useful for reviewing large, complex patch files.
Packit bef1e6
It reads from one or more input files which contain output from \fBdiff\fP,
Packit bef1e6
producing a histogram of the total lines changed for each file referenced.
Packit bef1e6
.PP
Packit bef1e6
If the input filename ends with .bz2, .gz, .lzma, .z or .Z,
Packit bef1e6
\fBdiffstat\fP will read the
Packit bef1e6
uncompressed data via a pipe from the corresponding program.
Packit bef1e6
It also can infer the compression type from files piped via the standard input.
Packit bef1e6
.PP
Packit bef1e6
\fBDiffstat\fP recognizes the most popular types of output from \fBdiff\fP:
Packit bef1e6
.RS 3
Packit bef1e6
.TP
Packit bef1e6
unified
Packit bef1e6
preferred by the \fBpatch\fP utility.
Packit bef1e6
.TP
Packit bef1e6
context
Packit bef1e6
best for readability, but not very compact.
Packit bef1e6
.TP
Packit bef1e6
default
Packit bef1e6
not good for much, but simple to generate.
Packit bef1e6
.RE
Packit bef1e6
.PP
Packit bef1e6
\fBDiffstat\fP detects the lines that are output by \fBdiff\fP to
Packit bef1e6
tell which files are compared, and then counts the markers in the
Packit bef1e6
first column that denote the type of change (insertion, deletion
Packit bef1e6
or modification).
Packit bef1e6
These are shown in the histogram as "+", "\-" and "!" characters.
Packit bef1e6
.PP
Packit bef1e6
If no filename is given on the command line,
Packit bef1e6
\fBdiffstat\fP reads the differences from the standard input.
Packit bef1e6
.SH OPTIONS
Packit bef1e6
.TP
Packit bef1e6
.B \-b
Packit bef1e6
ignore lines matching "Binary files XXX and YYY differ" in the \fBdiff\fP
Packit bef1e6
.TP
Packit bef1e6
.B \-c
Packit bef1e6
prefix each line of output with "#", making it a comment-line for shell
Packit bef1e6
scripts.
Packit bef1e6
.TP
Packit bef1e6
.B \-C
Packit bef1e6
add SGR color escape sequences to highlight the histogram.
Packit bef1e6
.TP
Packit bef1e6
.BI \-D " destination"
Packit bef1e6
specify a directory containing files which can be referred to as
Packit bef1e6
the result of applying the differences.
Packit bef1e6
\fBdiffstat\fP will count the lines in the corresponding files
Packit bef1e6
(after adjusting the names by the \fB\-p\fP option)
Packit bef1e6
to obtain the total number of lines in each file.
Packit bef1e6
.IP
Packit bef1e6
The remainder, after subtracting modified and deleted lines,
Packit bef1e6
is shown as "unchanged lines".
Packit bef1e6
.TP
Packit bef1e6
.BI \-d
Packit bef1e6
The debug prints a lot of information.
Packit bef1e6
It is normally compiled-in, but can be suppressed.
Packit bef1e6
.TP
Packit bef1e6
.BI \-e " file"
Packit bef1e6
redirect standard error to \fIfile\fR.
Packit bef1e6
.TP
Packit bef1e6
.BI \-E
Packit bef1e6
strip out ANSI escape sequences on each line before parsing the differences.
Packit bef1e6
This allows \fBdiffstat\fP to be used with \fBcolordiff\fP.
Packit bef1e6
.TP
Packit bef1e6
.BI \-f " format"
Packit bef1e6
specify the format of the histogram.
Packit bef1e6
.RS
Packit bef1e6
.TP 3
Packit bef1e6
0
Packit bef1e6
for concise, which shows only the value and a single histogram code for each of
Packit bef1e6
insert (+),
Packit bef1e6
delete (\-) or
Packit bef1e6
modify (!)
Packit bef1e6
.TP 3
Packit bef1e6
1
Packit bef1e6
for normal output,
Packit bef1e6
.TP 3
Packit bef1e6
2
Packit bef1e6
to fill in the histogram with dots,
Packit bef1e6
.TP 3
Packit bef1e6
4
Packit bef1e6
to print each value with the histogram.
Packit bef1e6
.RE
Packit bef1e6
.IP
Packit bef1e6
Any nonzero value gives a histogram.
Packit bef1e6
The dots and individual values can be combined,
Packit bef1e6
e.g., \fB\-f6\fP gives both.
Packit bef1e6
.TP
Packit bef1e6
.B \-h
Packit bef1e6
prints the usage message and exits.
Packit bef1e6
.TP
Packit bef1e6
.B \-k
Packit bef1e6
suppress the merging of filenames in the report.
Packit bef1e6
.TP
Packit bef1e6
.B \-K
Packit bef1e6
attempt to improve the annotation of "only" files
Packit bef1e6
by looking for a match in the resulting set of files and
Packit bef1e6
inferring whether the file was added or removed.
Packit bef1e6
.IP
Packit bef1e6
This does not currently work in combination with \fB\-R\fP because
Packit bef1e6
\fBdiffstat\fP maintains only the resulting set of files.
Packit bef1e6
.TP
Packit bef1e6
.B \-l
Packit bef1e6
lists only the filenames.
Packit bef1e6
No histogram is generated.
Packit bef1e6
.TP
Packit bef1e6
.B \-m
Packit bef1e6
merge insert/delete counts from each "chunk" of the patch file to
Packit bef1e6
approximate a count of the modified lines.
Packit bef1e6
.TP
Packit bef1e6
.BI \-n " number"
Packit bef1e6
specify the minimum width used for filenames.
Packit bef1e6
If you do not specify this, \fBdiffstat\fP uses the length of the longest
Packit bef1e6
filename, after stripping common prefixes.
Packit bef1e6
.TP
Packit bef1e6
.BI \-N " number"
Packit bef1e6
specify the maximum width used for filenames.
Packit bef1e6
Names longer than this limit are truncated on the left.
Packit bef1e6
If you do not specify this, \fBdiffstat\fP next checks the \fB\-n\fP option.
Packit bef1e6
.TP
Packit bef1e6
.BI \-o " file"
Packit bef1e6
redirect standard output to \fIfile\fR.
Packit bef1e6
.TP
Packit bef1e6
.BI \-p " number"
Packit bef1e6
override the logic that strips common pathnames, simulating the \fBpatch\fP
Packit bef1e6
"\-p" option.
Packit bef1e6
.IP
Packit bef1e6
If you do not give a \fB\-p\fP option, \fBdiffstat\fP examines the
Packit bef1e6
differences and strips the common prefix from the pathnames.
Packit bef1e6
This is not what \fBpatch\fP does.
Packit bef1e6
.TP
Packit bef1e6
.B \-q
Packit bef1e6
suppress the "0 files changed" message for empty diffs.
Packit bef1e6
.TP
Packit bef1e6
.B \-r " code"
Packit bef1e6
provides optional rounding of the data shown in histogram,
Packit bef1e6
rather than truncating with error adjustments.
Packit bef1e6
.RS
Packit bef1e6
.TP 3
Packit bef1e6
0
Packit bef1e6
is the default.
Packit bef1e6
No rounding is performed,
Packit bef1e6
but accumulated errors are added to following columns.
Packit bef1e6
.TP 3
Packit bef1e6
1
Packit bef1e6
rounds the data
Packit bef1e6
.TP 3
Packit bef1e6
2
Packit bef1e6
rounds the data and adjusts the histogram to ensure that
Packit bef1e6
it displays something if there are any differences even if
Packit bef1e6
those would normally be rounded to zero.
Packit bef1e6
.RE
Packit bef1e6
.TP
Packit bef1e6
.B \-R
Packit bef1e6
Assume patch was created with old and new files swapped.
Packit bef1e6
.TP
Packit bef1e6
.BI \-s
Packit bef1e6
show only the summary line, e.g., number of insertions and deletions.
Packit bef1e6
.TP
Packit bef1e6
.BI \-S " source"
Packit bef1e6
this is like the \fB\-D\fP option, but specifies a location where
Packit bef1e6
the original files (before applying differences) can be found.
Packit bef1e6
.TP
Packit bef1e6
.B \-t
Packit bef1e6
overrides the histogram,
Packit bef1e6
generates output of comma separated values for the number of
Packit bef1e6
changed lines found in the differences for each file: inserted, deleted and modified.
Packit bef1e6
.IP
Packit bef1e6
If \fB\-S\fP or \fB\-D\fP options are given, the number of unchanged
Packit bef1e6
lines precedes the number of changes.
Packit bef1e6
.TP
Packit bef1e6
.B \-T
Packit bef1e6
prints the numbers that the \fB\-t\fP option would show,
Packit bef1e6
between the pathname and histogram.
Packit bef1e6
.IP
Packit bef1e6
The width of the number of changes is determined by the largest value (but at least 3).
Packit bef1e6
The width given in the \fB\-w\fP option is separate from the width of these
Packit bef1e6
numbers.
Packit bef1e6
.TP
Packit bef1e6
.B \-u
Packit bef1e6
suppress the sorting of filenames in the report.
Packit bef1e6
.TP
Packit bef1e6
.B \-v
Packit bef1e6
show progress,
Packit bef1e6
e.g., if the output is redirected to a file,
Packit bef1e6
write progress messages to the standard error.
Packit bef1e6
.TP
Packit bef1e6
.B \-V
Packit bef1e6
prints the current version number and exits.
Packit bef1e6
.TP
Packit bef1e6
.BI \-w " number"
Packit bef1e6
specify the maximum width of the histogram.
Packit bef1e6
The histogram will never be shorter than 10 columns,
Packit bef1e6
just in case the filenames get too large.
Packit bef1e6
.SH ENVIRONMENT
Packit bef1e6
.PP
Packit bef1e6
\fBDiffstat\fP runs in a POSIX environment.
Packit bef1e6
.PP
Packit bef1e6
You can override the compiled-in paths of programs used for decompressing
Packit bef1e6
input files by setting environment variables corresponding to their name:
Packit bef1e6
.sp
Packit bef1e6
.RS
Packit bef1e6
.nf
Packit bef1e6
DIFFSTAT_BZCAT_PATH
Packit bef1e6
DIFFSTAT_BZIP2_PATH
Packit bef1e6
DIFFSTAT_COMPRESS_PATH
Packit bef1e6
DIFFSTAT_GZIP_PATH
Packit bef1e6
DIFFSTAT_LZCAT_PATH
Packit bef1e6
DIFFSTAT_PCAT_PATH
Packit bef1e6
DIFFSTAT_UNCOMPRESS_PATH
Packit bef1e6
DIFFSTAT_XZ_PATH
Packit bef1e6
DIFFSTAT_ZCAT_PATH
Packit bef1e6
.fi
Packit bef1e6
.RE
Packit bef1e6
.PP
Packit bef1e6
However, \fBdiffstat\fP assumes that the resulting program uses the
Packit bef1e6
same command-line options, e.g., "\-c" to decompress to the standard output.
Packit bef1e6
.SH FILES
Packit bef1e6
.PP
Packit bef1e6
\fBDiffstat\fP is a single binary module, which uses no auxiliary files.
Packit bef1e6
.SH BUGS
Packit bef1e6
.PP
Packit bef1e6
\fBDiffstat\fP makes a lot of assumptions about the format of \fBdiff\fP's output.
Packit bef1e6
.PP
Packit bef1e6
There is no way to obtain a filename from the standard \fBdiff\fP between
Packit bef1e6
two files with no options.
Packit bef1e6
Context diffs work,
Packit bef1e6
as well as unified diffs.
Packit bef1e6
.PP
Packit bef1e6
There's no easy way to determine the degree of overlap between the
Packit bef1e6
"before" and "after" displays of modified lines.
Packit bef1e6
\fBdiffstat\fP simply counts the number of inserted and deleted lines
Packit bef1e6
to approximate modified lines for the \fB\-m\fP option.
Packit bef1e6
.SH SEE ALSO
Packit bef1e6
.PP
Packit bef1e6
.BR diff (1),
Packit bef1e6
.BR patch (1).
Packit bef1e6
.SH AUTHOR
Packit bef1e6
.PP
Packit bef1e6
Thomas Dickey <dickey@invisible-island.net>.