Browse Source

fix crlf problem; update doc and test make targets

Matthew Wang 11 years ago
parent
commit
af238312ba
4 changed files with 38 additions and 6 deletions
  1. 5
    3
      Makefile
  2. 2
    2
      README.md
  3. 1
    1
      src/cdiff.py
  4. 30
    0
      tests/crlf.diff

+ 5
- 3
Makefile View File

@@ -1,6 +1,8 @@
1 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 7
 dogfood:
6 8
 	git diff | src/cdiff.py
@@ -8,9 +10,9 @@ dogfood:
8 10
 	git diff | src/cdiff.py -s -w 60
9 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 16
 	src/cdiff.py tests/$@.diff
15 17
 	src/cdiff.py tests/$@.diff -s
16 18
 	src/cdiff.py tests/$@.diff | diff -u tests/$@.diff -

+ 2
- 2
README.md View File

@@ -18,8 +18,8 @@ whatever directory which is in your `$PATH`, for example, `$HOME/bin` is in my
18 18
 ## Usage
19 19
     
20 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 24
 View a diff (patch) file:
25 25
 

+ 1
- 1
src/cdiff.py View File

@@ -131,7 +131,7 @@ class Diff(object):
131 131
     def markup_side_by_side(self, width):
132 132
         """Returns a generator"""
133 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 136
         def _fit_width(markup, width, pad=False):
137 137
             """str len does not count correctly if left column contains ansi

+ 30
- 0
tests/crlf.diff View File

@@ -0,0 +1,30 @@
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