File: diffstat.1

package info (click to toggle)
diffstat 1.62-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 3,028 kB
  • sloc: sh: 3,129; ansic: 2,587; makefile: 170
file content (282 lines) | stat: -rw-r--r-- 8,945 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
.\"*****************************************************************************
.\" Copyright 1994-2016,2018 by Thomas E. Dickey                               *
.\" All Rights Reserved.                                                       *
.\"                                                                            *
.\" Permission to use, copy, modify, and distribute this software and its      *
.\" documentation for any purpose and without fee is hereby granted, provided  *
.\" that the above copyright notice appear in all copies and that both that    *
.\" copyright notice and this permission notice appear in supporting           *
.\" documentation, and that the name of the above listed copyright holder(s)   *
.\" not be used in advertising or publicity pertaining to distribution of the  *
.\" software without specific, written prior permission.                       *
.\"                                                                            *
.\" THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD   *
.\" TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND  *
.\" FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE  *
.\" FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES          *
.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN      *
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR *
.\" IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.                *
.\"*****************************************************************************
.\" $Id: diffstat.1,v 1.39 2018/08/15 00:29:55 tom Exp $
.ie \n(.g .ds `` \(lq
.el       .ds `` ``
.ie \n(.g .ds '' \(rq
.el       .ds '' ''
.TH DIFFSTAT 1
.SH NAME
\fBdiffstat\fP \- make histogram from diff-output
.SH SYNOPSIS
\fBdiffstat\fP\fI [options] [file-specifications]\fP
.SH DESCRIPTION
This program reads the output of \fBdiff\fP and displays a histogram
of the insertions, deletions, and modifications per-file.
\fBDiffstat\fP is a program that is useful for reviewing large,
complex patch files.
It reads from one or more input files which contain output from \fBdiff\fP,
producing a histogram of the total lines changed for each file referenced.
.PP
If the input filename ends with
\*(``.bz2\*('',
\*(``.gz\*('',
\*(``.lzma\*('',
\*(``.xz\*('',
\*(``.z\*('' or
\*(``.Z\*('',
\fBdiffstat\fP will read the
uncompressed data via a pipe from the corresponding program.
It also can infer the compression type from files piped via the standard input.
.PP
\fBDiffstat\fP recognizes the most popular types of output from \fBdiff\fP:
.RS 3
.TP
unified
preferred by the \fBpatch\fP utility.
.TP
context
best for readability, but not very compact.
.TP
default
not good for much, but simple to generate.
.RE
.PP
\fBDiffstat\fP detects the lines that are output by \fBdiff\fP to
tell which files are compared, and then counts the markers in the
first column that denote the type of change (insertion, deletion
or modification).
These are shown in the histogram as "+", "\-" and "!" characters.
.PP
If no filename is given on the command line,
\fBdiffstat\fP reads the differences from the standard input.
.SH OPTIONS
.TP
.B \-b
ignore lines matching "Binary files XXX and YYY differ" in the \fBdiff\fP
.TP
.B \-c
prefix each line of output with "#", making it a comment-line for shell
scripts.
.TP
.B \-C
add SGR color escape sequences to highlight the histogram.
.TP
.BI \-D " destination"
specify a directory containing files which can be referred to as
the result of applying the differences.
\fBdiffstat\fP will count the lines in the corresponding files
(after adjusting the names by the \fB\-p\fP option)
to obtain the total number of lines in each file.
.IP
The remainder, after subtracting modified and deleted lines,
is shown as "unchanged lines".
.TP
.B \-d
The debug prints a lot of information.
It is normally compiled-in, but can be suppressed.
.TP
.BI \-e " file"
redirect standard error to \fIfile\fR.
.TP
.B \-E
strip out ANSI escape sequences on each line before parsing the differences.
This allows \fBdiffstat\fP to be used with \fBcolordiff\fP.
.TP
.BI \-f " format"
specify the format of the histogram.
.RS
.TP 3
0
for concise, which shows only the value and a single histogram code for each of
insert (+),
delete (\-) or
modify (!)
.TP 3
1
for normal output,
.TP 3
2
to fill in the histogram with dots,
.TP 3
4
to print each value with the histogram.
.RE
.IP
Any nonzero value gives a histogram.
The dots and individual values can be combined,
e.g., \fB\-f6\fP gives both.
.TP
.B \-h
prints the usage message and exits.
.TP
.B \-k
suppress the merging of filenames in the report.
.TP
.B \-K
attempt to improve the annotation of "only" files
by looking for a match in the resulting set of files and
inferring whether the file was added or removed.
.IP
This does not currently work in combination with \fB\-R\fP because
\fBdiffstat\fP maintains only the resulting set of files.
.TP
.B \-l
lists only the filenames.
No histogram is generated.
.TP
.B \-m
merge insert/delete counts from each "chunk" of the patch file to
approximate a count of the modified lines.
.TP
.BI \-n " number"
specify the minimum width used for filenames.
If you do not specify this, \fBdiffstat\fP uses the length of the longest
filename, after stripping common prefixes.
.TP
.BI \-N " number"
specify the maximum width used for filenames.
Names longer than this limit are truncated on the left.
If you do not specify this, \fBdiffstat\fP next checks the \fB\-n\fP option.
.TP
.BI \-o " file"
redirect standard output to \fIfile\fR.
.TP
.BI \-p " number"
override the logic that strips common pathnames, simulating the \fBpatch\fP
"\-p" option.
.IP
If you do not give a \fB\-p\fP option, \fBdiffstat\fP examines the
differences and strips the common prefix from the pathnames.
This is not what \fBpatch\fP does.
.TP
.B \-q
suppress the "0 files changed" message for empty diffs.
.TP
.B \-r " code"
provides optional rounding of the data shown in histogram,
rather than truncating with error adjustments.
.RS
.TP 3
0
is the default.
No rounding is performed,
but accumulated errors are added to following columns.
.TP 3
1
rounds the data
.TP 3
2
rounds the data and adjusts the histogram to ensure that
it displays something if there are any differences even if
those would normally be rounded to zero.
.RE
.TP
.B \-R
Assume patch was created with old and new files swapped.
.TP
.B \-s
show only the summary line, e.g., number of insertions and deletions.
.TP
.BI \-S " source"
this is like the \fB\-D\fP option, but specifies a location where
the original files (before applying differences) can be found.
.TP
.B \-t
overrides the histogram,
generates output of comma separated values for the number of
changed lines found in the differences for each file:
inserted, deleted and modified.
.IP
If \fB\-S\fP or \fB\-D\fP options are given, the number of unchanged
lines precedes the number of changes.
.TP
.B \-T
prints the numbers that the \fB\-t\fP option would show,
between the pathname and histogram.
.IP
The width of the number of changes is determined
by the largest value (but at least 3).
The width given in the \fB\-w\fP option is separate from the width of these
numbers.
.TP
.B \-u
suppress the sorting of filenames in the report.
.TP
.B \-v
show progress,
e.g., if the output is redirected to a file,
write progress messages to the standard error.
.TP
.B \-V
prints the current version number and exits.
.TP
.BI \-w " number"
specify the maximum width of the histogram.
The histogram will never be shorter than 10 columns,
just in case the filenames get too large.
.SH ENVIRONMENT
.PP
\fBDiffstat\fP runs in a POSIX environment.
.PP
You can override the compiled-in paths of programs used for decompressing
input files by setting environment variables corresponding to their name:
.sp
.RS
.nf
DIFFSTAT_BZCAT_PATH
DIFFSTAT_BZIP2_PATH
DIFFSTAT_COMPRESS_PATH
DIFFSTAT_GZIP_PATH
DIFFSTAT_LZCAT_PATH
DIFFSTAT_PCAT_PATH
DIFFSTAT_UNCOMPRESS_PATH
DIFFSTAT_XZ_PATH
DIFFSTAT_ZCAT_PATH
.fi
.RE
.PP
However, \fBdiffstat\fP assumes that the resulting program uses the
same command-line options, e.g., "\-c" to decompress to the standard output.
.SH FILES
.PP
\fBDiffstat\fP is a single binary module, which uses no auxiliary files.
.SH BUGS
.PP
\fBDiffstat\fP makes a lot of assumptions
about the format of \fBdiff\fP's output.
.PP
There is no way to obtain a filename from the standard \fBdiff\fP between
two files with no options.
Context diffs work,
as well as unified diffs.
.PP
There's no easy way to determine the degree of overlap between the
"before" and "after" displays of modified lines.
\fBdiffstat\fP simply counts the number of inserted and deleted lines
to approximate modified lines for the \fB\-m\fP option.
.SH SEE ALSO
.PP
.BR diff (1),
.BR patch (1).
.SH AUTHOR
.PP
Thomas Dickey <dickey@invisible-island.net>.