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