|
@@ -5,9 +5,9 @@ Cdiff
|
5
|
5
|
:target: https://travis-ci.org/ymattw/cdiff
|
6
|
6
|
:alt: Build status
|
7
|
7
|
|
8
|
|
-Term based tool to view **colored**, **incremental** diff in *Git/Mercurial/Svn*
|
9
|
|
-workspace or from stdin, with **side by side** and **auto pager** support.
|
10
|
|
-Requires python (>= 2.5.0) and ``less``.
|
|
8
|
+Term based tool to view *colored*, *incremental* diff in a *Git/Mercurial/Svn*
|
|
9
|
+workspace or from stdin, with *side by side* and *auto pager* support. Requires
|
|
10
|
+python (>= 2.5.0) and ``less``.
|
11
|
11
|
|
12
|
12
|
.. image:: http://ymattw.github.com/cdiff/img/default.png
|
13
|
13
|
:alt: default
|
|
@@ -28,7 +28,7 @@ Cdiff is already listed on `PyPI <http://pypi.python.org/pypi/cdiff>`_, you can
|
28
|
28
|
install with ``pip`` if you have the tool.
|
29
|
29
|
|
30
|
30
|
.. code:: sh
|
31
|
|
-
|
|
31
|
+
|
32
|
32
|
pip install --upgrade cdiff
|
33
|
33
|
|
34
|
34
|
Install with setup.py
|
|
@@ -51,17 +51,29 @@ my ``$PATH``, so I save the script there and name as ``cdiff``.
|
51
|
51
|
|
52
|
52
|
.. code:: sh
|
53
|
53
|
|
54
|
|
- curl -ksS https://raw.github.com/ymattw/cdiff/master/cdiff.py > ~/bin/cdiff
|
|
54
|
+ curl https://raw.github.com/ymattw/cdiff/master/cdiff.py > ~/bin/cdiff
|
55
|
55
|
chmod +x ~/bin/cdiff
|
56
|
56
|
|
57
|
57
|
Usage
|
58
|
58
|
-----
|
59
|
59
|
|
60
|
|
-Show usage:
|
|
60
|
+Type ``cdiff -h`` to show usage:
|
61
|
61
|
|
62
|
|
-.. code:: sh
|
|
62
|
+.. code::
|
|
63
|
+
|
|
64
|
+ $ cdiff -h
|
|
65
|
+ Usage: cdiff [options] [file|dir ...]
|
63
|
66
|
|
64
|
|
- cdiff -h
|
|
67
|
+ View colored, incremental diff in a workspace or from stdin, with side by side
|
|
68
|
+ and auto pager support
|
|
69
|
+
|
|
70
|
+ Options:
|
|
71
|
+ --version show program's version number and exit
|
|
72
|
+ -h, --help show this help message and exit
|
|
73
|
+ -s, --side-by-side enable side-by-side mode
|
|
74
|
+ -w N, --width=N set text width for side-by-side mode, default is 80
|
|
75
|
+ -l, --log show log with changes from revision control
|
|
76
|
+ -c X, --color=X colorize mode 'auto' (default), 'always', or 'never'
|
65
|
77
|
|
66
|
78
|
Read diff from local modification in a *Git/Mercurial/Svn* workspace:
|
67
|
79
|
|
|
@@ -79,21 +91,26 @@ Read the log with changes (e.g. ``git log -p``, ``svn log --diff``) in a
|
79
|
91
|
.. code:: sh
|
80
|
92
|
|
81
|
93
|
cd proj-workspace
|
82
|
|
- cdiff -l
|
83
|
|
- cdiff -ls # equivalent to cdiff -l -s
|
84
|
|
- cdiff -ls -w90
|
|
94
|
+ cdiff -l # read log along with changes
|
|
95
|
+ cdiff -ls # equivalent to cdiff -l -s, view side by side
|
|
96
|
+ cdiff -ls -w90 # set text width 90 as well
|
85
|
97
|
cdiff -ls file1 dir2 # see log with changes of given files/dirs only
|
86
|
98
|
|
87
|
99
|
Pipe in a diff:
|
88
|
100
|
|
89
|
101
|
.. code:: sh
|
90
|
102
|
|
91
|
|
- git log -p -2 | cdiff -s # view git log with changes of last 2 commits
|
92
|
|
- git show 15bfa | cdiff -s # view a git commit
|
|
103
|
+ git log -p -2 | cdiff # view git log with changes of last 2 commits
|
|
104
|
+ git show 15bfa | cdiff -s # view a given git commit, side by side
|
93
|
105
|
svn diff -r1234 | cdiff -s # view svn diff comparing to given revision
|
94
|
|
- diff -u foo bar | cdiff # pipe in diff between two files (note the '-u')
|
95
|
|
- diff -ur dir1 dir2 | cdiff # pipe in diff between two dirs
|
96
|
|
- cat foo.patch | cdiff # or cdiff < foo.path to view a unified patch
|
|
106
|
+ diff -u file1 file2 | cdiff # view diff between two files (note the '-u')
|
|
107
|
+ diff -ur dir1 dir2 | cdiff # view diff between two dirs
|
|
108
|
+ cat foo.patch | cdiff # view a unified patch (or cdiff < foo.path)
|
|
109
|
+
|
|
110
|
+ # View a GitHub pull request, side by side (GitHub web interface is missing
|
|
111
|
+ # this feature :)
|
|
112
|
+ #
|
|
113
|
+ curl https://github.com/ymattw/cdiff/pull/11.diff | cdiff -s
|
97
|
114
|
|
98
|
115
|
Redirect output to another patch file is safe:
|
99
|
116
|
|
|
@@ -111,8 +128,8 @@ Cdiff has following known issues:
|
111
|
128
|
- Terminal might be in a mess on exception (type ``reset`` can fix it)
|
112
|
129
|
|
113
|
130
|
Pull requests are very welcome, please make sure your changes can pass unit
|
114
|
|
-tests and regression tests by run ``make test`` (required tool *coverage* can be
|
115
|
|
-installed with ``pip install coverage``). Also watch out `travis build
|
|
131
|
+tests and regression tests by run ``make test`` (required tool *coverage* can
|
|
132
|
+be installed with ``pip install coverage``). Also watch out `travis build
|
116
|
133
|
<https://travis-ci.org/ymattw/cdiff>`_ after push, make sure it passes as well.
|
117
|
134
|
|
118
|
135
|
See also
|