Skip to content

Commit

Permalink
Document/usage update for 0.7
Browse files Browse the repository at this point in the history
  • Loading branch information
ymattw committed Feb 22, 2013
1 parent 957483a commit 176bd40
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 31 deletions.
7 changes: 4 additions & 3 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
Change log
==========

Version 0.7 (2013-02-22)
Version 0.7 (2013-02-23)

- Support reading diff or log for given files/dirs in workspace (usage changed
on reading a patch file or two given files!)
- Support reading diff or log for given files/dirs in workspace
- Support diff generated from ``diff -ru dir1 dir2``
- Usage change: reading a patch and comparing two files need stdin redirect

Version 0.6 (2013-02-20)

Expand Down
30 changes: 12 additions & 18 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ Cdiff
:alt: Build status

Term based tool to view **colored**, **incremental** diff in *Git/Mercurial/Svn*
workspace, given patch or two files, or from stdin, with **side by side** and
**auto pager** support. Requires python (>= 2.5.0) and ``less``.
workspace or from stdin, with **side by side** and **auto pager** support.
Requires python (>= 2.5.0) and ``less``.

.. image:: http://ymattw.github.com/cdiff/img/default.png
:alt: default
Expand Down Expand Up @@ -68,12 +68,12 @@ Read diff from local modification in a *Git/Mercurial/Svn* workspace:
.. code:: sh
cd proj-workspace
cdiff # view colored incremental udiff
cdiff # view colored incremental diff
cdiff -s # view side by side
cdiff -s -w 90 # use text width 90 other than default 80
cdiff -s file1 dir2 # view modification of given files/dirs only
Read the log with diff (e.g. ``git log -p``, ``svn log --diff``) in a
Read the log with changes (e.g. ``git log -p``, ``svn log --diff``) in a
*Git/Mercurial/Svn* workspace (note *--diff* option is new in svn 1.7.0):

.. code:: sh
Expand All @@ -82,25 +82,19 @@ Read the log with diff (e.g. ``git log -p``, ``svn log --diff``) in a
cdiff -l
cdiff -ls # equivalent to cdiff -l -s
cdiff -ls -w90
cdiff -ls file1 dir2 # view log with diff of given files/dirs only
cdiff -ls file1 dir2 # see log with changes of given files/dirs only
Pipe in a diff:

.. code:: sh
git log -p -2 | cdiff -s
git show 15bfa5 | cdiff -s
svn diff -r PREV | cdiff -s
diff -u foo bar | cdiff # note cdiff only takes unified diff
diff -ur dir1 dir2 | cdiff # read diff of two dirs
View a diff (patch) file:

.. code:: sh
cdiff < foo.patch # or cat foo.patch | cdiff
cdiff -s < foo.patch
cdiff -s -w 90 < foo.patch
git log -p -2 | cdiff -s # view git log with changes of last 2 commits
git show 15bfa | cdiff -s # view a git commit
svn diff -r1234 | cdiff -s # view svn diff comparing to given revision
cdiff < foo.patch # view a patch file (unified format only)
cat foo.patch | cdiff # same as above
diff -u foo bar | cdiff # pipe in diff between two files (note the '-u')
diff -ur dir1 dir2 | cdiff # pipe in diff between two dirs
Redirect output to another patch file is safe:

Expand Down
17 changes: 7 additions & 10 deletions cdiff.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

"""
Term based tool to view **colored**, **incremental** diff in Git/Mercurial/Svn
workspace, given patch or two files, or from stdin, with **side by side** and
**auto pager** support. Requires python (>= 2.5.0) and ``less``.
workspace or from stdin, with **side by side** and **auto pager** support.
Requires python (>= 2.5.0) and ``less``.
"""

META_INFO = {
Expand All @@ -14,9 +14,8 @@
'email' : 'mattwyl(@)gmail(.)com',
'url' : 'https://github.com/ymattw/cdiff',
'keywords' : 'colored incremental side-by-side diff',
'description' : ('View colored, incremental diff in workspace, given patch '
'or two files, or from stdin, with side by side and auto '
'pager support')
'description' : ('View colored, incremental diff in workspace or from '
'stdin, with side by side and auto pager support')
}

import sys
Expand Down Expand Up @@ -639,18 +638,16 @@ def main():

supported_vcs = sorted(VCS_INFO.keys())

usage = """
%prog [options]
%prog [options] [file ...]"""
usage = """%prog [options] [file|dir ...]"""
parser = optparse.OptionParser(usage=usage,
description=META_INFO['description'],
version='%%prog %s' % META_INFO['version'])
parser.add_option('-s', '--side-by-side', action='store_true',
help='show in side-by-side mode')
help='enable side-by-side mode')
parser.add_option('-w', '--width', type='int', default=80, metavar='N',
help='set text width (side-by-side mode only), default is 80')
parser.add_option('-l', '--log', action='store_true',
help='show diff log from revision control')
help='show log with changes from revision control')
parser.add_option('-c', '--color', default='auto', metavar='X',
help='colorize mode "auto" (default), "always", or "never"')
opts, args = parser.parse_args()
Expand Down

0 comments on commit 176bd40

Please sign in to comment.