svn diff — 比较两条路径的区别。
diff [-c M | -r N[:M]] [TARGET[@REV]...]
diff [-r N[:M]] --old=OLD-TGT[@OLDREV] [--new=NEW-TGT[@NEWREV]] [PATH...]
diff OLD-URL[@OLDREV] NEW-URL[@NEWREV]
Display the differences between two paths. You can use svn diff in the following ways:
Use just svn diffto display local modifications in a working copy.
Display the changes made to
TARGETs as they are seen in
REV between two revisions.
TARGETs may be all working copy
paths or all URLs. If
TARGETs are working copy paths,
N defaults to
BASE and M
to the working copy; if TARGETs
are URLs,
N must be specified and
M defaults to
HEAD. The -c M option
is equivalent to -r N:M where N =
M-1. Using -c -M does the
reverse: -r M:N where N =
M-1.
Display the differences between
OLD-TGT as it was seen in
OLDREV and
NEW-TGT as it was seen in
NEWREV.
PATHs, if given, are relative
to OLD-TGT and
NEW-TGT and restrict the output
to differences for those paths.
OLD-TGT and
NEW-TGT may be working copy
paths or URL[@REV].
NEW-TGT defaults to
OLD-TGT if not specified.
-r N
makes OLDREV default to
N; -r N:M
makes OLDREV default to
N and
NEWREV default to
M.
diff OLD-URL[@OLDREV] NEW-URL[@NEWREV] is shorthand for svn diff --old=OLD-URL[@OLDREV] --new=NEW-URL[@NEWREV].
svn diff -r N:M URL是svn diff -r N:M --old=URL --new=URL的简写。
svn diff [-r N[:M]] URL1[@N] URL2[@M]是 svn diff [-r N[:M]] --old=URL1 --new=URL2的简写。
If TARGET is a URL, then
revs N and M can be given either via the
--revision option or by using the
“@” notation as described earlier.
如果TARGET是工作拷贝路径,则--revision选项的含义是:
--revision N:M
The server compares
TARGET@N
and
TARGET@M.
--revision N
The client compares
TARGET@N
against working copy.
--revision)客户端比较base和 TARGET的TARGET。
如果使用其他语法,服务器会比较URL1和URL2各自的N和M。如果省掉N或M,会假定为HEAD。
By default, svn diff ignores the
ancestry of files and merely compares the contents of the
two files being compared. If you use
--notice-ancestry, the ancestry of the
paths in question will be taken into consideration when
comparing revisions (that is, if you run svn
diff on two files with identical contents but
different ancestry, you will see the entire contents of
the file as having been removed and added again).
--revision (-r) ARG --change (-c) ARG --old ARG --new ARG --depth ARG --diff-cmd CMD --extensions (-x) "ARGS" --no-diff-deleted --notice-ancestry --summarize --force --username USER --password PASS --no-auth-cache --non-interactive --config-dir DIR --changelist ARG --xml
比较BASE和你的工作拷贝(svn diff最经常的用法):
$ svn diff COMMITTERS Index: COMMITTERS =================================================================== --- COMMITTERS (revision 4404) +++ COMMITTERS (working copy)
查看文件COMMITTERS在修订版本9115修改的内容:
$ svn diff -c 9115 COMMITTERS Index: COMMITTERS =================================================================== --- COMMITTERS (revision 3900) +++ COMMITTERS (working copy)
察看你的工作拷贝对旧的修订版本的修改:
$ svn diff -r 3900 COMMITTERS Index: COMMITTERS =================================================================== --- COMMITTERS (revision 3900) +++ COMMITTERS (working copy)
使用“@”语法与修订版本3000和35000比较:
$ svn diff http://svn.collab.net/repos/svn/trunk/COMMITTERS@3000 \
http://svn.collab.net/repos/svn/trunk/COMMITTERS@3500
Index: COMMITTERS
===================================================================
--- COMMITTERS (revision 3000)
+++ COMMITTERS (revision 3500)
…
Compare revision 3000 to revision 3500 using range notation (pass only the one URL in this case):
$ svn diff -r 3000:3500 http://svn.collab.net/repos/svn/trunk/COMMITTERS Index: COMMITTERS =================================================================== --- COMMITTERS (revision 3000) +++ COMMITTERS (revision 3500)
Compare revision 3000 to revision 3500 of all the files in
trunk using range notation:
$ svn diff -r 3000:3500 http://svn.collab.net/repos/svn/trunk
使用范围符号比较修订版本3000和3500trunk中的三个文件:
$ svn diff -r 3000:3500 --old http://svn.collab.net/repos/svn/trunk COMMITTERS README HACKING
如果你有工作拷贝,你不必输入这么长的URL:
$ svn diff -r 3000:3500 COMMITTERS Index: COMMITTERS =================================================================== --- COMMITTERS (revision 3000) +++ COMMITTERS (revision 3500)
Use --diff-cmd
CMD -x to
pass arguments directly to the external diff
program:
$ svn diff --diff-cmd /usr/bin/diff -x "-i -b" COMMITTERS Index: COMMITTERS =================================================================== 0a1,2 > This is a test >
Lastly, you can use the --xml option
along with the --summarize option to view
xml describing the changes that occurred between
revisions, but not the contents of the diff itself:
$ svn diff --summarize --xml http://svn.red-bean.com/repos/test@r2 http://svn.red-bean.com/repos/test <?xml version="1.0"?> <diff> <paths> <path props="none" kind="file" item="modified">http://svn.red-bean.com/repos/test/sandwich.txt</path> <path props="none" kind="file" item="deleted">http://svn.red-bean.com/repos/test/burrito.txt</path> <path props="none" kind="dir" item="added">http://svn.red-bean.com/repos/test/snacks</path> </paths> </diff>