For the purposes of code review, after an existing source file is modified, we only review lines of code that have been changed in those source files.
After I make changes to source files in a repository, I must communicate the lines of code that have changed in a source file before we do our peer code reviews.
I am able to see a visual diff using WinMerge, and I am happy with what it does for me, but the only requirement for my co-workers is simply to know the file name and the line numbers that need to be reviewed.
Is there a way to get only the line numbers of a changed file? The types of files would be text source files, such as Javascript, Java, XML, XSL, etc.
Sample files--
foo (new version):
a
b
c
d
e
f
g
h
i
j
k
foo (old version):
a
b
C
d
h
i
k
The output I'm looking for:
foo: 3, 5-7, 10-11
OR
foo:
3
5-7
10-11
I'm sure that some program allows for this. I just can't find one. Any suggestions? I'm currently using WinMerge, but any program that runs on Windows will be fine with me. It would be preferable if the software is open-source or freeware.
EDIT: GNU DiffUtils is close to what I want, but not exactly fitting my needs. Looking at the command line options, I see "-q" (or "--brief") as a simplified diff, but it's TOO simple. Output:
C:\Program Files\GnuWin32\bin>diff.exe -q foo1.txt foo2.txt
Files foo1.txt and foo2.txt differ
Normal diff output:
C:\Program Files\GnuWin32\bin>diff.exe foo1.txt foo2.txt
3c3
< c
---
> C
5,7d4
< e
< f
< g
10,11c7
< j
< k
---
> k
\ No newline at end of file
diff -u output:
C:\Program Files\GnuWin32\bin>diff.exe -u foo1.txt foo2.txt
--- foo1.txt 2010-11-09 15:47:12.447916000 -0600
+++ foo2.txt 2010-11-09 15:47:36.129954700 -0600
@@ -1,11 +1,7 @@
a
b
- c
+ C
d
- e
- f
- g
h
i
- j
- k
+ k
\ No newline at end of file
I'm looking for something more informative than diff -q, but less informative than diff -u and diff. Any diff ninjas out there who are aware of different options to allow this?
I will always be comparing a new, recently modified file to an older one. I only need the things that need reviewing on the new file.
GNU DiffUtils is open source, free, and has a Windows port.