• Stars
    star
    4,177
  • Rank 10,371 (Top 0.3 %)
  • Language
    Python
  • License
    Other
  • Created over 14 years ago
  • Updated 8 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

improved colored diff

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.

More Repositories

1

apartment_prices

Rent heatmaps
Python
170
star
2

bucket-brigade

JavaScript
21
star
3

chords

Python
20
star
4

trackpad_synth

Make music with a macbook trackpad
C
20
star
5

nomic

Automated nomic
Python
18
star
6

webscripts

Scripts for manipulating my website
Python
17
star
7

whistle-synth

zero-crossing based pitch detection for whistling
Shell
17
star
8

shrubgrazer

Alternative Mastodon UI
Python
14
star
9

mbtaplot

mbta bus plotter using google app engine
Python
11
star
10

trycontra

source for trycontra.com
HTML
10
star
11

comments-selenium

Archive public facebook comments with selenium
Python
7
star
12

syllable

Python
6
star
13

gcmidi

Use a PS4 Controller as multiple MIDI Expression Controllers
Objective-C
6
star
14

statmbx

Reads mbox files and prints out information about unread messages.
C
5
star
15

rewriting-proxy

Simple pluggable python interface for proxies that modify content
Python
5
star
16

jammer

C
4
star
17

poscheck

Python decorator to reject positional arguments
Python
4
star
18

fix_path

Reverse resolution of environment variables
C
4
star
19

hanabi

Python
3
star
20

prodlogger

Automatic Computer Usage Tracking
C
3
star
21

looper_sync

redirect between microphone, buffers, and speakers controled by mouse clicks
C
2
star
22

diplomator

Mapping, emailing, and knowlege management tools for Star Trek Diplomacy variant st02
Python
2
star
23

decimals

Python
2
star
24

lightlightbox

JavaScript
2
star
25

tempo

realtime tempo detection
C
2
star
26

nextbus

Code behind www,jefftk.com/nextbus/mbta/
Python
2
star
27

vsl1818

control an AB1818vsl remotely
Python
2
star
28

location-history

Python
2
star
29

air-quality-modeling

Python
2
star
30

game-complexity

Python
2
star
31

blinksticknet

Python
2
star
32

hits-frequency

Python
1
star
33

octaveless

C
1
star
34

zipquiz

Quiz game for zipcodes
1
star
35

nanopore_pipeline

Python
1
star
36

simplechat

Python
1
star
37

cpicsv

convert BLS CPI text files to CSV
Python
1
star
38

melodybox

Java
1
star
39

density

Python
1
star
40

lyme

Python
1
star
41

trumpet

Python
1
star
42

scrape-forum-magnum

Python
1
star
43

standing-event

Python
1
star
44

hangouts-takeout

Python
1
star
45

bidadance.org

HTML
1
star
46

dances-timeline-graph

Python
1
star