diff --git a/CHANGES b/CHANGES index 8f68269..21f7d83 100644 --- a/CHANGES +++ b/CHANGES @@ -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) diff --git a/README.rst b/README.rst index 91b7b8c..a17b09d 100644 --- a/README.rst +++ b/README.rst @@ -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 @@ -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 @@ -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: diff --git a/cdiff.py b/cdiff.py index f29bbad..5a2ee12 100755 --- a/cdiff.py +++ b/cdiff.py @@ -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 = { @@ -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 @@ -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()