|
@@ -0,0 +1,78 @@
|
|
1
|
+Cdiff
|
|
2
|
+=====
|
|
3
|
+
|
|
4
|
+View **colored**, **incremental** diff in unified format or **side by side**
|
|
5
|
+with **auto pager**. Requires python (>= 2.5.0) and ``less``.
|
|
6
|
+
|
|
7
|
+.. image: http://ymattw.github.com/cdiff/img/default.png
|
|
8
|
+ :alt: default
|
|
9
|
+
|
|
10
|
+.. image: http://ymattw.github.com/cdiff/img/side-by-side.png
|
|
11
|
+ :alt: side by side
|
|
12
|
+
|
|
13
|
+Installation
|
|
14
|
+------------
|
|
15
|
+
|
|
16
|
+Cdiff is not in PyPI yet, so far you could download the script directly or use
|
|
17
|
+the ``setup.py`` to install.
|
|
18
|
+
|
|
19
|
+**Download directly**
|
|
20
|
+
|
|
21
|
+Save `src/cdiff.py <https://raw.github.com/ymattw/cdiff/master/src/cdiff.py>` to
|
|
22
|
+whatever directory which is in your ``$PATH``, for example, ``$HOME/bin`` is in
|
|
23
|
+my ``$PATH``, so I save the script there and name as ``cdiff``.
|
|
24
|
+
|
|
25
|
+ curl -ksS https://raw.github.com/ymattw/cdiff/master/src/cdiff.py > ~/bin/cdiff
|
|
26
|
+ chmod +x ~/bin/cdiff
|
|
27
|
+
|
|
28
|
+**Install with the setup.py**
|
|
29
|
+
|
|
30
|
+You can run the setup.py from the source to install ``cdiff`` to system wide
|
|
31
|
+directory.
|
|
32
|
+
|
|
33
|
+ git clone https://github.com/ymattw/cdiff.git
|
|
34
|
+ cd cdiff
|
|
35
|
+ sudo ./setup.py install
|
|
36
|
+
|
|
37
|
+This usually installs it as ``/usr/local/bin/cdiff``.
|
|
38
|
+
|
|
39
|
+Usage
|
|
40
|
+-----
|
|
41
|
+
|
|
42
|
+Cdiff reads diff from diff (patch) file if given, or stdin if redirected, or
|
|
43
|
+diff produced by revision tool if in a git/svn/hg workspace. Use option ``-s``
|
|
44
|
+to enable side by side view, and option ``-w N`` to set a text width other than
|
|
45
|
+default ``80``. See examples below.
|
|
46
|
+
|
|
47
|
+Show usage:
|
|
48
|
+
|
|
49
|
+ cdiff -h
|
|
50
|
+
|
|
51
|
+View a diff (patch) file:
|
|
52
|
+
|
|
53
|
+ cdiff foo.patch # view colored incremental udiff
|
|
54
|
+ cdiff foo.patch -s # view side by side
|
|
55
|
+ cdiff foo.patch -s -w 90 # use text width 90 other than default 80
|
|
56
|
+
|
|
57
|
+Read diff from local modification in a svn, git, or hg workspace:
|
|
58
|
+
|
|
59
|
+ cd proj-workspace
|
|
60
|
+ cdiff
|
|
61
|
+ cdiff -s
|
|
62
|
+ cdiff -s -w 90
|
|
63
|
+
|
|
64
|
+Pipe in a diff:
|
|
65
|
+
|
|
66
|
+ svn diff -r PREV | cdiff -s
|
|
67
|
+ git log -p -2 | cdiff -s
|
|
68
|
+ git show <commit> | cdiff -s
|
|
69
|
+
|
|
70
|
+Redirect output to another patch file is safe:
|
|
71
|
+
|
|
72
|
+ svn diff | cdiff -s > my.patch
|
|
73
|
+
|
|
74
|
+Known issue
|
|
75
|
+-----------
|
|
76
|
+
|
|
77
|
+- Only support unified format for input diff
|
|
78
|
+- Side by side mode has alignment problem for wide chars
|