development/icdiff: Added (improved color diff)

Signed-off-by: Dave Woodfall <dave@slackbuilds.org>

Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
This commit is contained in:
B. Watson 2020-11-20 13:55:49 +00:00 committed by Willy Sudiarto Raharjo
parent 62b0a3cf50
commit 4b5aaa2bff
No known key found for this signature in database
GPG key ID: 3F617144D7238786
7 changed files with 398 additions and 0 deletions

10
development/icdiff/README Normal file
View file

@ -0,0 +1,10 @@
icdiff (improved color diff)
Show differences between files in a colorful two column view. Can be
used with as a "git diff" replacement, via "git-icdiff" command.
Note: It's highly recommended to use wide terminals with icdiff, for
instance 160 columns or more.
icdiff is similar in concept to colordiff, but it uses a two column
"side by side" format.

View file

@ -0,0 +1,51 @@
Description: fix closed pipe handling
Author: Sascha Steinbiss <satta@debian.org>
Bug: https://github.com/jeffkaufman/icdiff/issues/156
Forwarded: https://github.com/jeffkaufman/icdiff/pull/165
Last-Update: 2019-09-25
--- a/icdiff
+++ b/icdiff
@@ -594,7 +594,22 @@
validate_has_two_arguments(parser, args)
if not options.cols:
set_cols_option(options)
- diff(options, *args)
+ try:
+ diff(options, *args)
+ except KeyboardInterrupt:
+ pass
+ except IOError as e:
+ if e.errno == errno.EPIPE:
+ pass
+ else:
+ raise
+
+ # Close stderr to prevent printing errors when icdiff is piped to
+ # something that closes before icdiff is done writing
+ #
+ # See: https://stackoverflow.com/questions/26692284/...
+ # ...how-to-prevent-brokenpipeerror-when-doing-a-flush-in-python
+ sys.stderr.close()
def codec_print(s, options):
@@ -755,18 +770,4 @@
if __name__ == "__main__":
- try:
- start()
- except KeyboardInterrupt:
- pass
- except IOError as e:
- if e.errno == errno.EPIPE:
- pass
- else:
- raise
- # Close stderr to prevent printing errors when icdiff is piped to
- # something that closes before icdiff is done writing
- #
- # See: https://stackoverflow.com/questions/26692284/
- # how-to-prevent-brokenpipeerror-when-doing-a-flush-in-python
- sys.stderr.close()
+ start()

134
development/icdiff/icdiff.1 Normal file
View file

@ -0,0 +1,134 @@
.\" Man page generated from reStructuredText.
.
.TH ICDIFF 1 "2020-11-15" "1.9.5" "SlackBuilds.org"
.SH NAME
icdiff \- improved color diff
.
.nr rst2man-indent-level 0
.
.de1 rstReportMargin
\\$1 \\n[an-margin]
level \\n[rst2man-indent-level]
level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
-
\\n[rst2man-indent0]
\\n[rst2man-indent1]
\\n[rst2man-indent2]
..
.de1 INDENT
.\" .rstReportMargin pre:
. RS \\$1
. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
. nr rst2man-indent-level +1
.\" .rstReportMargin post:
..
.de UNINDENT
. RE
.\" indent \\n[an-margin]
.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
.nr rst2man-indent-level -1
.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
..
.\" RST source for icdiff(1) man page. Convert with:
.
.\" rst2man.py icdiff.rst > icdiff.1
.
.\" rst2man.py comes from the SBo development/docutils package.
.
.SH SYNOPSIS
.sp
icdiff [\fI\-options\fP] left_file right_file
.sp
git\-icdiff [\fIgit diff options\fP]
.SH DESCRIPTION
.sp
\fBicdiff\fP show differences between files in a colorful two column view.
.sp
\fBgit\-icdiff\fP is a wrapper around \fBgit diff\fP that uses \fBicdiff\fP to show diffs.
.SH OPTIONS
.INDENT 0.0
.TP
.B \-\-version
show program\(aqs version number and exit
.TP
.B \-h\fP,\fB \-\-help
show this help message and exit
.TP
.BI \-\-cols\fB= COLS
specify the width of the screen. Autodetection is Unix only
.TP
.BI \-\-encoding\fB= ENCODING
specify the file encoding; defaults to utf8
.TP
.BI \-E \ MATCHER\fP,\fB \ \-\-exclude\-lines\fB= MATCHER
Do not diff lines that match this regex. Not compatible with the \(aqline\-numbers\(aq option
.TP
.BI \-\-head\fB= HEAD
consider only the first N lines of each file
.TP
.B \-H\fP,\fB \-\-highlight
color by changing the background color instead of the foreground color. Very fast, ugly, displays all changes
.TP
.BI \-L \ LABELS\fP,\fB \ \-\-label\fB= LABELS
override file labels with arbitrary tags. Use twice, one for each file
.TP
.B \-N\fP,\fB \-\-line\-numbers
generate output with line numbers. Not compatible with the \(aqexclude\-lines\(aq option.
.TP
.B \-\-no\-bold
use non\-bold colors; recommended for solarized
.TP
.B \-\-no\-headers
don\(aqt label the left and right sides with their file names
.TP
.BI \-\-output\-encoding\fB= OUTPUT_ENCODING
specify the output encoding; defaults to utf8
.TP
.B \-r\fP,\fB \-\-recursive
recursively compare subdirectories
.TP
.B \-\-show\-all\-spaces
color all non\-matching whitespace including that which is not needed for drawing the eye to changes. Slow, ugly, displays all changes
.TP
.BI \-\-tabsize\fB= TABSIZE
tab stop spacing
.TP
.B \-u\fP,\fB \-\-patch
generate patch. This is always true, and only exists for compatibility
.TP
.BI \-U \ NUM\fP,\fB \ \-\-unified\fB= NUM\fP,\fB \ \-\-numlines\fB= NUM
how many lines of context to print; can\(aqt be combined with \-\-whole\-file
.TP
.B \-W\fP,\fB \-\-whole\-file
show the whole file instead of just changed lines and context
.TP
.B \-\-strip\-trailing\-cr
strip any trailing carriage return at the end of an input line
.TP
.BI \-\-color\-map\fB= COLOR_MAP
choose which colors are used for which items. Default is \-\-color\-map=\(aqadd:green_bold,change:yellow_bold,description:blue,meta:magenta,separator:blue,subtract:red_bold\(aq. You don\(aqt have to override all of them: \(aq\-\-color\-map=separator:white,description:cyan\(aq
.UNINDENT
.SH NOTE
.sp
It\(aqs highly recommended to use wide terminals with \fBicdiff\fP, for
instance 160 columns or more.
.SH EXAMPLES
.sp
See the file /usr/doc/icdiff\-1.9.5/README.md for examples.
.SH COPYRIGHT
.sp
See the file /usr/doc/icdiff\-1.9.5/LICENSE for license information.
.SH AUTHORS
.sp
icdiff was written by Jeff Kaufman.
.sp
This man page written for the SlackBuilds.org project
by B. Watson, and is licensed under the WTFPL.
.SH SEE ALSO
.sp
diff(1), colordiff(1), git\-difftool(1)
.sp
The icdiff homepage: \fI\%https://www.jefftk.com/icdiff\fP
.\" Generated by docutils manpage writer.
.

View file

@ -0,0 +1,81 @@
#!/bin/sh
# Slackware build script for icdiff
# Written by B. Watson (yalhcru@gmail.com)
# Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.
PRGNAM=icdiff
VERSION=${VERSION:-1.9.5}
SRCVER=release-$VERSION
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
if [ -z "$ARCH" ]; then
case "$( uname -m )" in
i?86) ARCH=i586 ;;
arm*) ARCH=arm ;;
*) ARCH=$( uname -m ) ;;
esac
fi
CWD=$(pwd)
TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}
if [ "$ARCH" = "i586" ]; then
SLKCFLAGS="-O2 -march=i586 -mtune=i686"
LIBDIRSUFFIX=""
elif [ "$ARCH" = "i686" ]; then
SLKCFLAGS="-O2 -march=i686 -mtune=i686"
LIBDIRSUFFIX=""
elif [ "$ARCH" = "x86_64" ]; then
SLKCFLAGS="-O2 -fPIC"
LIBDIRSUFFIX="64"
else
SLKCFLAGS="-O2"
LIBDIRSUFFIX=""
fi
set -e
rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PRGNAM-$SRCVER
tar xvf $CWD/$PRGNAM-$SRCVER.tar.gz
cd $PRGNAM-$SRCVER
chown -R root:root .
find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \
\! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} \+
# patch from upstream git by way of Debian: Close stderr to prevent
# printing errors when icdiff is piped to something that closes before
# icdiff is done writing.
patch -p1 < $CWD/fix-pipe-handling-installed.patch
# 20201115 bkw: at some point, Slackware's /usr/bin/python will be python3.
# This stuff can go away then.
case "${PYVER:-auto}" in
2|3) ;; # use as-is
auto) PYVER=2; python3 -c 'import sys' 2>/dev/null && PYVER=3 ;;
esac
python$PYVER setup.py install --root=$PKG
# man page made from README.md by SlackBuild author.
mkdir -p $PKG/usr/man/man1
gzip -9c < $CWD/$PRGNAM.1 > $PKG/usr/man/man1/$PRGNAM.1.gz
ln -s $PRGNAM.1.gz $PKG/usr/man/man1/git-$PRGNAM.1.gz
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp -a README* LICENSE* $PKG/usr/doc/$PRGNAM-$VERSION
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
cd $PKG
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}

View file

@ -0,0 +1,10 @@
PRGNAM="icdiff"
VERSION="1.9.5"
HOMEPAGE="https://www.jefftk.com/icdiff"
DOWNLOAD="https://github.com/jeffkaufman/icdiff/archive/release-1.9.5/icdiff-release-1.9.5.tar.gz"
MD5SUM="c896202f930336dfa461a0295019f887"
DOWNLOAD_x86_64=""
MD5SUM_x86_64=""
REQUIRES=""
MAINTAINER="B. Watson"
EMAIL="yalhcru@gmail.com"

View file

@ -0,0 +1,93 @@
.. RST source for icdiff(1) man page. Convert with:
.. rst2man.py icdiff.rst > icdiff.1
.. rst2man.py comes from the SBo development/docutils package.
.. |version| replace:: 1.9.5
.. |date| date::
======
icdiff
======
-------------------
improved color diff
-------------------
:Manual section: 1
:Manual group: SlackBuilds.org
:Date: |date|
:Version: |version|
SYNOPSIS
========
icdiff [*-options*] left_file right_file
git-icdiff [*git diff options*]
DESCRIPTION
===========
**icdiff** show differences between files in a colorful two column view.
**git-icdiff** is a wrapper around **git diff** that uses **icdiff** to show diffs.
OPTIONS
=======
--version show program's version number and exit
-h, --help show this help message and exit
--cols=COLS specify the width of the screen. Autodetection is Unix only
--encoding=ENCODING specify the file encoding; defaults to utf8
-E MATCHER, --exclude-lines=MATCHER
Do not diff lines that match this regex. Not compatible with the 'line-numbers' option
--head=HEAD consider only the first N lines of each file
-H, --highlight color by changing the background color instead of the foreground color. Very fast, ugly, displays all changes
-L LABELS, --label=LABELS
override file labels with arbitrary tags. Use twice, one for each file
-N, --line-numbers generate output with line numbers. Not compatible with the 'exclude-lines' option.
--no-bold use non-bold colors; recommended for solarized
--no-headers don't label the left and right sides with their file names
--output-encoding=OUTPUT_ENCODING
specify the output encoding; defaults to utf8
-r, --recursive recursively compare subdirectories
--show-all-spaces color all non-matching whitespace including that which is not needed for drawing the eye to changes. Slow, ugly, displays all changes
--tabsize=TABSIZE tab stop spacing
-u, --patch generate patch. This is always true, and only exists for compatibility
-U NUM, --unified=NUM, --numlines=NUM
how many lines of context to print; can't be combined with --whole-file
-W, --whole-file show the whole file instead of just changed lines and context
--strip-trailing-cr strip any trailing carriage return at the end of an input line
--color-map=COLOR_MAP
choose which colors are used for which items. Default is --color-map='add:green_bold,change:yellow_bold,description:blue,meta:magenta,separator:blue,subtract:red_bold'. You don't have to override all of them: '--color-map=separator:white,description:cyan'
NOTE
====
It's highly recommended to use wide terminals with **icdiff**, for
instance 160 columns or more.
EXAMPLES
========
See the file /usr/doc/icdiff-|version|/README.md for examples.
COPYRIGHT
=========
See the file /usr/doc/icdiff-|version|/LICENSE for license information.
AUTHORS
=======
icdiff was written by Jeff Kaufman.
This man page written for the SlackBuilds.org project
by B. Watson, and is licensed under the WTFPL.
SEE ALSO
========
diff(1), colordiff(1), git-difftool(1)
The icdiff homepage: https://www.jefftk.com/icdiff

View file

@ -0,0 +1,19 @@
# HOW TO EDIT THIS FILE:
# The "handy ruler" below makes it easier to edit a package description.
# Line up the first '|' above the ':' following the base package name, and
# the '|' on the right side marks the last column you can put a character in.
# You must make exactly 11 lines for the formatting to be correct. It's also
# customary to leave one space after the ':' except on otherwise blank lines.
|-----handy-ruler------------------------------------------------------|
icdiff: icdiff (improved color diff)
icdiff:
icdiff: Show differences between files in a colorful two column view. Can be
icdiff: used with as a "git diff" replacement, via "git-icdiff" command.
icdiff:
icdiff:
icdiff:
icdiff:
icdiff:
icdiff:
icdiff: