Skip to main content

improved colored diff

Project description

Icdiff

Improved colored diff

screenshot

Installation

Download the latest icdiff and put it on your PATH.

Alternatively, install with packaging tools:

# pip
pip install icdiff

# apt
sudo apt install icdiff

# homebrew
brew install icdiff

# aur
yay -S icdiff

# nix
nix-env -i icdiff

Usage

icdiff [options] left_file right_file

Show differences between files in a two column view.

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
  -s, --report-identical-files
                        report when two files are the same
  --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
  -t, --truncate        truncate long lines instead of wrapping them
  -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,desc
                        ription:blue,meta:magenta,separator:blue,subtract:red_
                        bold'.  You don't have to override all of them:
                        '--color-map=separator:white,description:cyan

Using with Git

To see what it looks like, try:

git difftool --extcmd icdiff

To install this as a tool you can use with Git, copy git-icdiff into your PATH and run:

git icdiff

You can configure git-icdiff in Git's config:

git config --global icdiff.options '--highlight --line-numbers'

Using with subversion

To try it out, run:

svn diff --diff-cmd icdiff

Using with Mercurial

Add the following to your ~/.hgrc:

[extensions]
extdiff=

[extdiff]
cmd.icdiff=icdiff
opts.icdiff=--recursive --line-numbers

Or check more in-depth setup instructions.

Setting up a dev environment

Create a virtualenv and install the dev dependencies. This is not needed for normal usage.

virtualenv venv
source venv/bin/activate
pip install -r requirements-dev.txt

Running tests

./test.sh python3

Making a release

  • Update ChangeLog with all the changes since the last release
  • Update __version__ in icdiff
  • Run tests, make sure they pass
  • git commit -a -m "release ${version}"
  • git push
  • git tag release-${version}
  • git push origin release-${version}
  • A GitHub Action should be triggered due to the release tag being pushed, and will upload to PyPI.

License

This file is derived from difflib.HtmlDiff which is under license. I release my changes here under the same license. This is GPL compatible.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

icdiff-2.0.10.tar.gz (16.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

icdiff-2.0.10-py3-none-any.whl (17.1 kB view details)

Uploaded Python 3

File details

Details for the file icdiff-2.0.10.tar.gz.

File metadata

  • Download URL: icdiff-2.0.10.tar.gz
  • Upload date:
  • Size: 16.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for icdiff-2.0.10.tar.gz
Algorithm Hash digest
SHA256 75a3de5c9af35ab45fb0504df59770c514a12c0d2b2c99e5f9c5c2429957e133
MD5 314ef2426bb6c83a33d213ad40645726
BLAKE2b-256 5b6d41c8ff13b67c30ceb9325398ff6bb9fc4b77208c6c1d79db8d5913840bc6

See more details on using hashes here.

Provenance

The following attestation bundles were made for icdiff-2.0.10.tar.gz:

Publisher: release.yml on jeffkaufman/icdiff

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file icdiff-2.0.10-py3-none-any.whl.

File metadata

  • Download URL: icdiff-2.0.10-py3-none-any.whl
  • Upload date:
  • Size: 17.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for icdiff-2.0.10-py3-none-any.whl
Algorithm Hash digest
SHA256 fd8ce592d94261c435e2a410f668a41ec3be4527878f8df01100797021d8edb0
MD5 1944cbf8f993642b297dd6c1b4ae5462
BLAKE2b-256 854bbb94514476624bfff977599e5ef3ac9aea603abb693639ed305b22ed1b35

See more details on using hashes here.

Provenance

The following attestation bundles were made for icdiff-2.0.10-py3-none-any.whl:

Publisher: release.yml on jeffkaufman/icdiff

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page