I'm bad dumb and having no google fu. How do you get diff (on os x if it matters...) to look like svn diffs? Couldn't figure it out from the man page either. :(
What I want
Index: test.txt
===================开发者_运维知识库================================================
--- test.txt (revision 365)
+++ test.txt (working copy)
@@ -1,7 +1,9 @@
This
is
the
-original
+updated
+and
+awesomer
file.
-Unf.
+Duh.
You want the -u flag.
diff -u file1 file2
From the diff
man page:
-u -U NUM --unified[=NUM]
Output NUM (default 3) lines of unified context.
It's not exactly the same (no big row of equals signs, for example), but it should do what you want. Your example from above:
--- file1 2009-10-16 15:14:24.000000000 -0700
+++ file2 2009-10-16 15:14:50.000000000 -0700
@@ -1,7 +1,9 @@
This
is
the
-original
+updated
+and
+awesomer
file.
-Unf.
+Duh.
subversion uses a slightly extended version of the unified diff format. Wikipedias page on Diff explains the format itself, and also notes the differences to the subversion ones.
As has been said, the diff tool (see its man page for details) uses the -u
option to produce unified diffs.
diff -u file1 file2
精彩评论