README.md
1# Icdiff
2
3Improved colored diff
4
5![screenshot](http://www.jefftk.com/icdiff-css-demo.png)
6
7## Installation
8
9Download the [latest](https://github.com/jeffkaufman/icdiff/releases) `icdiff` binary and put it on your PATH.
10
11Alternatively, install with pip:
12```
13 pip install git+https://github.com/jeffkaufman/icdiff.git
14```
15
16It can be also installed using [AUR](https://aur.archlinux.org/packages/icdiff/)
17```
18 yay -S icdiff
19```
20It can be also installed using [Nix](https://nixos.org/nix/)
21
22```
23 nix-env -i icdiff
24```
25
26## Usage
27
28```sh
29icdiff [options] left_file right_file
30```
31
32Show differences between files in a two column view.
33
34### Options
35```
36 --version show program's version number and exit
37 -h, --help show this help message and exit
38 --cols=COLS specify the width of the screen. Autodetection is Unix
39 only
40 --encoding=ENCODING specify the file encoding; defaults to utf8
41 -E MATCHER, --exclude-lines=MATCHER
42 Do not diff lines that match this regex. Not
43 compatible with the 'line-numbers' option
44 --head=HEAD consider only the first N lines of each file
45 -H, --highlight color by changing the background color instead of the
46 foreground color. Very fast, ugly, displays all
47 changes
48 -L LABELS, --label=LABELS
49 override file labels with arbitrary tags. Use twice,
50 one for each file
51 -N, --line-numbers generate output with line numbers. Not compatible with
52 the 'exclude-lines' option.
53 --no-bold use non-bold colors; recommended for solarized
54 --no-headers don't label the left and right sides with their file
55 names
56 --output-encoding=OUTPUT_ENCODING
57 specify the output encoding; defaults to utf8
58 -r, --recursive recursively compare subdirectories
59 -s, --report-identical-files
60 report when two files are the same
61 --show-all-spaces color all non-matching whitespace including that which
62 is not needed for drawing the eye to changes. Slow,
63 ugly, displays all changes
64 --tabsize=TABSIZE tab stop spacing
65 -t, --truncate truncate long lines instead of wrapping them
66 -u, --patch generate patch. This is always true, and only exists
67 for compatibility
68 -U NUM, --unified=NUM, --numlines=NUM
69 how many lines of context to print; can't be combined
70 with --whole-file
71 -W, --whole-file show the whole file instead of just changed lines and
72 context
73 --strip-trailing-cr strip any trailing carriage return at the end of an
74 input line
75 --color-map=COLOR_MAP
76 choose which colors are used for which items. Default
77 is --color-map='add:green_bold,change:yellow_bold,desc
78 ription:blue,meta:magenta,separator:blue,subtract:red_
79 bold'. You don't have to override all of them:
80 '--color-map=separator:white,description:cyan
81```
82
83## Using with Git
84
85To see what it looks like, try:
86
87```sh
88git difftool --extcmd icdiff
89```
90
91To install this as a tool you can use with Git, copy
92`git-icdiff` into your PATH and run:
93
94```sh
95git icdiff
96```
97
98You can configure `git-icdiff` in Git's config:
99
100```
101git config --global icdiff.options '--highlight --line-numbers'
102```
103
104## Using with subversion
105
106To try it out, run:
107
108```sh
109svn diff --diff-cmd icdiff
110```
111
112## Using with Mercurial
113
114Add the following to your `~/.hgrc`:
115
116```sh
117[extensions]
118extdiff=
119
120[extdiff]
121cmd.icdiff=icdiff
122opts.icdiff=--recursive --line-numbers
123```
124
125Or check more [in-depth setup instructions](http://ianobermiller.com/blog/2016/07/14/side-by-side-diffs-for-mercurial-hg-icdiff-revisited/).
126
127## Setting up a dev environment
128
129Create a virtualenv and install the dev dependencies.
130This is not needed for normal usage.
131
132```sh
133virtualenv venv
134source venv/bin/activate
135pip install -r requirements-dev.txt
136```
137
138## Running tests
139
140```sh
141./test.sh python3
142```
143
144## Making a release
145
146* Update ChangeLog with all the changes since the last release
147* Update `__version__` in `icdiff`
148* Run tests, make sure they pass
149* `git commit -a -m "release ${version}"`
150* `git push`
151* `git tag release-${version}`
152* `git push origin release-${version}`
153
154## License
155
156This file is derived from `difflib.HtmlDiff` which is under [license](http://www.python.org/download/releases/2.6.2/license/).
157I release my changes here under the same license. This is GPL compatible.
158