ソースを参照

Document/usage update for 0.7

Matthew Wang 11 年 前
コミット
176bd406a6
共有3 個のファイルを変更した23 個の追加31 個の削除を含む
  1. 4
    3
      CHANGES
  2. 12
    18
      README.rst
  3. 7
    10
      cdiff.py

+ 4
- 3
CHANGES ファイルの表示

2
 Change log
2
 Change log
3
 ==========
3
 ==========
4
 
4
 
5
-Version 0.7 (2013-02-22)
5
+Version 0.7 (2013-02-23)
6
 
6
 
7
-  - Support reading diff or log for given files/dirs in workspace (usage changed
8
-    on reading a patch file or two given files!)
7
+  - Support reading diff or log for given files/dirs in workspace
8
+  - Support diff generated from ``diff -ru dir1 dir2``
9
+  - Usage change: reading a patch and comparing two files need stdin redirect
9
 
10
 
10
 Version 0.6 (2013-02-20)
11
 Version 0.6 (2013-02-20)
11
 
12
 

+ 12
- 18
README.rst ファイルの表示

6
    :alt: Build status
6
    :alt: Build status
7
 
7
 
8
 Term based tool to view **colored**, **incremental** diff in *Git/Mercurial/Svn*
8
 Term based tool to view **colored**, **incremental** diff in *Git/Mercurial/Svn*
9
-workspace, given patch or two files, or from stdin, with **side by side** and
10
-**auto pager** support.  Requires python (>= 2.5.0) and ``less``.
9
+workspace or from stdin, with **side by side** and **auto pager** support.
10
+Requires python (>= 2.5.0) and ``less``.
11
 
11
 
12
 .. image:: http://ymattw.github.com/cdiff/img/default.png
12
 .. image:: http://ymattw.github.com/cdiff/img/default.png
13
    :alt: default
13
    :alt: default
68
 .. code:: sh
68
 .. code:: sh
69
 
69
 
70
     cd proj-workspace
70
     cd proj-workspace
71
-    cdiff                       # view colored incremental udiff
71
+    cdiff                       # view colored incremental diff
72
     cdiff -s                    # view side by side
72
     cdiff -s                    # view side by side
73
     cdiff -s -w 90              # use text width 90 other than default 80
73
     cdiff -s -w 90              # use text width 90 other than default 80
74
     cdiff -s file1 dir2         # view modification of given files/dirs only
74
     cdiff -s file1 dir2         # view modification of given files/dirs only
75
 
75
 
76
-Read the log with diff (e.g. ``git log -p``, ``svn log --diff``) in a
76
+Read the log with changes (e.g. ``git log -p``, ``svn log --diff``) in a
77
 *Git/Mercurial/Svn* workspace (note *--diff* option is new in svn 1.7.0):
77
 *Git/Mercurial/Svn* workspace (note *--diff* option is new in svn 1.7.0):
78
 
78
 
79
 .. code:: sh
79
 .. code:: sh
82
     cdiff -l
82
     cdiff -l
83
     cdiff -ls                   # equivalent to cdiff -l -s
83
     cdiff -ls                   # equivalent to cdiff -l -s
84
     cdiff -ls -w90
84
     cdiff -ls -w90
85
-    cdiff -ls file1 dir2        # view log with diff of given files/dirs only
85
+    cdiff -ls file1 dir2        # see log with changes of given files/dirs only
86
 
86
 
87
 Pipe in a diff:
87
 Pipe in a diff:
88
 
88
 
89
 .. code:: sh
89
 .. code:: sh
90
 
90
 
91
-    git log -p -2 | cdiff -s
92
-    git show 15bfa5 | cdiff -s
93
-    svn diff -r PREV | cdiff -s
94
-    diff -u foo bar | cdiff     # note cdiff only takes unified diff
95
-    diff -ur dir1 dir2 | cdiff  # read diff of two dirs
96
-
97
-View a diff (patch) file:
98
-
99
-.. code:: sh
100
-
101
-    cdiff < foo.patch           # or cat foo.patch | cdiff
102
-    cdiff -s < foo.patch
103
-    cdiff -s -w 90 < foo.patch
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
93
+    svn diff -r1234 | cdiff -s  # view svn diff comparing to given revision
94
+    cdiff < foo.patch           # view a patch file (unified format only)
95
+    cat foo.patch | cdiff       # same as above
96
+    diff -u foo bar | cdiff     # pipe in diff between two files (note the '-u')
97
+    diff -ur dir1 dir2 | cdiff  # pipe in diff between two dirs
104
 
98
 
105
 Redirect output to another patch file is safe:
99
 Redirect output to another patch file is safe:
106
 
100
 

+ 7
- 10
cdiff.py ファイルの表示

3
 
3
 
4
 """
4
 """
5
 Term based tool to view **colored**, **incremental** diff in Git/Mercurial/Svn
5
 Term based tool to view **colored**, **incremental** diff in Git/Mercurial/Svn
6
-workspace, given patch or two files, or from stdin, with **side by side** and
7
-**auto pager** support.  Requires python (>= 2.5.0) and ``less``.
6
+workspace or from stdin, with **side by side** and **auto pager** support.
7
+Requires python (>= 2.5.0) and ``less``.
8
 """
8
 """
9
 
9
 
10
 META_INFO = {
10
 META_INFO = {
14
     'email'       : 'mattwyl(@)gmail(.)com',
14
     'email'       : 'mattwyl(@)gmail(.)com',
15
     'url'         : 'https://github.com/ymattw/cdiff',
15
     'url'         : 'https://github.com/ymattw/cdiff',
16
     'keywords'    : 'colored incremental side-by-side diff',
16
     'keywords'    : 'colored incremental side-by-side diff',
17
-    'description' : ('View colored, incremental diff in workspace, given patch '
18
-                     'or two files, or from stdin, with side by side and  auto '
19
-                     'pager support')
17
+    'description' : ('View colored, incremental diff in workspace or from '
18
+                     'stdin, with side by side and auto pager support')
20
 }
19
 }
21
 
20
 
22
 import sys
21
 import sys
639
 
638
 
640
     supported_vcs = sorted(VCS_INFO.keys())
639
     supported_vcs = sorted(VCS_INFO.keys())
641
 
640
 
642
-    usage = """
643
-  %prog [options]
644
-  %prog [options] [file ...]"""
641
+    usage = """%prog [options] [file|dir ...]"""
645
     parser = optparse.OptionParser(usage=usage,
642
     parser = optparse.OptionParser(usage=usage,
646
             description=META_INFO['description'],
643
             description=META_INFO['description'],
647
             version='%%prog %s' % META_INFO['version'])
644
             version='%%prog %s' % META_INFO['version'])
648
     parser.add_option('-s', '--side-by-side', action='store_true',
645
     parser.add_option('-s', '--side-by-side', action='store_true',
649
-            help='show in side-by-side mode')
646
+            help='enable side-by-side mode')
650
     parser.add_option('-w', '--width', type='int', default=80, metavar='N',
647
     parser.add_option('-w', '--width', type='int', default=80, metavar='N',
651
             help='set text width (side-by-side mode only), default is 80')
648
             help='set text width (side-by-side mode only), default is 80')
652
     parser.add_option('-l', '--log', action='store_true',
649
     parser.add_option('-l', '--log', action='store_true',
653
-            help='show diff log from revision control')
650
+            help='show log with changes from revision control')
654
     parser.add_option('-c', '--color', default='auto', metavar='X',
651
     parser.add_option('-c', '--color', default='auto', metavar='X',
655
             help='colorize mode "auto" (default), "always", or "never"')
652
             help='colorize mode "auto" (default), "always", or "never"')
656
     opts, args = parser.parse_args()
653
     opts, args = parser.parse_args()