-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
110 additions
and
166 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,18 @@ | ||
# Makefile for testing | ||
|
||
.PHONY: dogfood test single-udiff multi-udiff | ||
.PHONY: dogfood test git svn | ||
|
||
dogfood: | ||
git diff | src/cdiff.py | ||
git diff | src/cdiff.py -s | ||
git diff | src/cdiff.py -s -w 60 | ||
git diff | src/cdiff.py -s -w 100 | ||
git diff | src/cdiff.py -s -w 90 | ||
|
||
test: single-udiff multi-udiff | ||
test: git svn | ||
|
||
single-udiff: | ||
src/cdiff.py tests/single.udiff | ||
src/cdiff.py tests/single.udiff | diff -u tests/single.udiff - | ||
|
||
multi-udiff: | ||
src/cdiff.py tests/multi.udiff | ||
src/cdiff.py tests/multi.udiff | diff -u tests/multi.udiff - | ||
git svn: | ||
src/cdiff.py tests/$@.diff | ||
src/cdiff.py tests/$@.diff -s | ||
src/cdiff.py tests/$@.diff | diff -u tests/$@.diff - | ||
|
||
# vim:set noet ts=8 sw=8: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
commit 15bfa564b9db08fb277a343a3d0a01d377800606 | ||
Author: Matthew Wang <XXXXXXX@gmail.com> | ||
Date: Thu Jan 31 15:27:17 2013 +0800 | ||
|
||
Default width is now 80 | ||
|
||
diff --git a/src/cdiff.py b/src/cdiff.py | ||
index 13f725f..bf15ef1 100755 | ||
--- a/src/cdiff.py | ||
+++ b/src/cdiff.py | ||
@@ -128,9 +128,7 @@ class Diff(object): | ||
yield self._markup_common(' ' + old[1]) | ||
|
||
def markup_side_by_side(self, width): | ||
- """width of 0 means infinite width, None means auto detect. Returns a | ||
- generator | ||
- """ | ||
+ """Returns a generator""" | ||
def _normalize(line): | ||
return line.replace('\t', ' ' * 8).replace('\n', '') | ||
|
||
@@ -147,7 +145,8 @@ class Diff(object): | ||
return markup | ||
|
||
# Setup line width and number width | ||
- if not width: width = 80 | ||
+ if width <= 0: | ||
+ width = 80 | ||
(start, offset) = self._hunks[-1].get_old_addr() | ||
max1 = start + offset - 1 | ||
(start, offset) = self._hunks[-1].get_new_addr() | ||
@@ -430,13 +429,10 @@ if __name__ == '__main__': | ||
parser = optparse.OptionParser(usage) | ||
parser.add_option('-s', '--side-by-side', action='store_true', | ||
help=('show in side-by-side mode')) | ||
- parser.add_option('-w', '--width', type='int', default=None, | ||
- help='set line width (side-by-side mode only)') | ||
+ parser.add_option('-w', '--width', type='int', default=80, | ||
+ help='set line width (side-by-side mode only), default is 80') | ||
opts, args = parser.parse_args() | ||
|
||
- if opts.width and opts.width < 0: | ||
- opts.width = 0 | ||
- | ||
if len(args) >= 1: | ||
diff_hdl = open(args[0], 'r') | ||
elif sys.stdin.isatty(): |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
Index: README.md | ||
=================================================================== | ||
--- README.md (revision 41) | ||
+++ README.md (working copy) | ||
@@ -3,7 +3,6 @@ | ||
## About | ||
|
||
Coderev is a toolkit generates static side-by-side html pages for code review. | ||
-Typical use case is to generate diff pages for local modification in svn/cvs | ||
workspace and send page link to teammates for code review. | ||
|
||
See [joyus.org/pub/coderev-demo](http://joyus.org/pub/coderev-demo) for a demo. | ||
@@ -18,9 +17,10 @@ | ||
|
||
## Usage of coderev.sh | ||
|
||
-Just type `./coderev.sh -h` to see the usage. | ||
+Just type `./coderev.sh --help` to see the usage. | ||
|
||
Usage: | ||
+ | ||
coderev.sh [-r revision] [-w width] [-o outdir] [-y] [-d name] \ | ||
[-F comment-file | -m 'comment...'] [file...] | ||
|
||
@@ -145,3 +145,5 @@ | ||
specify column number where lines are broken and | ||
wrapped for sdiff, default is no line wrapping | ||
-y, --yes do not prompt for overwriting | ||
+ | ||
+# EOF | ||
\ No newline at end of file |