瀏覽代碼

fix crlf problem; update doc and test make targets

Matthew Wang 11 年之前
父節點
當前提交
af238312ba
共有 4 個文件被更改,包括 38 次插入6 次删除
  1. 5
    3
      Makefile
  2. 2
    2
      README.md
  3. 1
    1
      src/cdiff.py
  4. 30
    0
      tests/crlf.diff

+ 5
- 3
Makefile 查看文件

1
 # Makefile for testing
1
 # Makefile for testing
2
 
2
 
3
-.PHONY: dogfood test git svn
3
+TESTS = git svn crlf
4
+
5
+.PHONY: dogfood test $(TESTS)
4
 
6
 
5
 dogfood:
7
 dogfood:
6
 	git diff | src/cdiff.py
8
 	git diff | src/cdiff.py
8
 	git diff | src/cdiff.py -s -w 60
10
 	git diff | src/cdiff.py -s -w 60
9
 	git diff | src/cdiff.py -s -w 90
11
 	git diff | src/cdiff.py -s -w 90
10
 
12
 
11
-test: git svn
13
+test: $(TESTS)
12
 
14
 
13
-git svn:
15
+$(TESTS):
14
 	src/cdiff.py tests/$@.diff
16
 	src/cdiff.py tests/$@.diff
15
 	src/cdiff.py tests/$@.diff -s
17
 	src/cdiff.py tests/$@.diff -s
16
 	src/cdiff.py tests/$@.diff | diff -u tests/$@.diff -
18
 	src/cdiff.py tests/$@.diff | diff -u tests/$@.diff -

+ 2
- 2
README.md 查看文件

18
 ## Usage
18
 ## Usage
19
     
19
     
20
 Just give it a diff (patch) file or pipe a diff to it.  Use option `-s` for
20
 Just give it a diff (patch) file or pipe a diff to it.  Use option `-s` for
21
-side-by-side view, and option `-w` to use text width other than default `80`.
22
-See examples below
21
+side-by-side view, and option `-w <N>` to use text width other than default
22
+`80`.  See examples below
23
 
23
 
24
 View a diff (patch) file:
24
 View a diff (patch) file:
25
 
25
 

+ 1
- 1
src/cdiff.py 查看文件

131
     def markup_side_by_side(self, width):
131
     def markup_side_by_side(self, width):
132
         """Returns a generator"""
132
         """Returns a generator"""
133
         def _normalize(line):
133
         def _normalize(line):
134
-            return line.replace('\t', ' ' * 8).replace('\n', '')
134
+            return line.replace('\t', ' '*8).replace('\n', '').replace('\r', '')
135
 
135
 
136
         def _fit_width(markup, width, pad=False):
136
         def _fit_width(markup, width, pad=False):
137
             """str len does not count correctly if left column contains ansi
137
             """str len does not count correctly if left column contains ansi

+ 30
- 0
tests/crlf.diff 查看文件

1
+Index: README.md
2
+===================================================================
3
+--- README.md	(revision 41)
4
++++ README.md	(working copy)
5
+@@ -3,7 +3,6 @@
6
+ ## About
7
+ 
8
+ Coderev is a toolkit generates static side-by-side html pages for code review.
9
+-Typical use case is to generate diff pages for local modification in svn/cvs
10
+ workspace and send page link to teammates for code review.
11
+ 
12
+ See [joyus.org/pub/coderev-demo](http://joyus.org/pub/coderev-demo) for a demo.
13
+@@ -18,9 +17,10 @@
14
+ 
15
+ ## Usage of coderev.sh
16
+ 
17
+-Just type `./coderev.sh -h` to see the usage.
18
++Just type `./coderev.sh --help` to see the usage.
19
+ 
20
+     Usage:
21
++
22
+         coderev.sh [-r revision] [-w width] [-o outdir] [-y] [-d name] \
23
+                 [-F comment-file | -m 'comment...'] [file...]
24
+ 
25
+@@ -145,3 +145,5 @@
26
+                             specify column number where lines are broken and
27
+                             wrapped for sdiff, default is no line wrapping
28
+     -y, --yes             do not prompt for overwriting
29
++
30
++# EOF