此文本正在进行中——可能会发生很大变化——可能无法准确描述 Apache™ Subversion® 软件的任何已发布版本。将此页面添加书签或以其他方式向他人推荐此页面可能不是一个好主意。请访问 https://svnbook.subversion.org.cn/ 获取此书的稳定版本。
svnlook diff — 打印更改的文件和属性的差异。
svnlook diff REPOS_PATH
这显示了一个新添加的(空的)文件、一个修改的二进制文件和一个重命名的(即复制和删除的)文件,其中包含修改。
$ svnlook diff -r 40 /var/svn/repos Copied: trunk/relish.txt (from rev 39, trunk/vendors/deli/pickle.txt) =================================================================== --- trunk/relish.txt (rev 0) +++ trunk/relish.txt 2013-01-29 20:39:17 UTC (rev 40) @@ -0,0 +1 @@ +Pickle relish is mostly made from cucumbers. Deleted: trunk/vendors/deli/pickle.txt =================================================================== --- trunk/vendors/deli/pickle.txt (rev 39) +++ trunk/vendors/deli/pickle.txt 2013-01-29 20:39:17 UTC (rev 49) @@ -1 +0,0 @@ -Pickles are mostly made from cucumbers. Modified: trunk/vendors/deli/logo.jpg =================================================================== (Binary files differ) Added: trunk/vendors/deli/soda.txt =================================================================== $
默认情况下,svnlook diff 将把复制的文件视为其他任何添加的文件,完整显示新文件的内容,只使用不同的标签来区分复制/添加。但是,您可以使用 --diff-copy-from
选项来使 svnlook diff 仅在复制文件与复制来源文件不同时才将其视为值得提及,并实际描述这些差异。
$ svnlook diff -r 40 /var/svn/repos --diff-copy-from Copied: trunk/relish.txt (from rev 39, trunk/vendors/deli/pickle.txt) =================================================================== --- trunk/vendors/deli/pickle.txt 2013-01-29 20:39:17 UTC (rev 39) +++ trunk/relish.txt 2013-01-29 20:47:40 UTC (rev 3) @@ -1 +1 @@ -Pickles are mostly made from cucumbers. +Pickle relish is mostly made from cucumbers. Deleted: trunk/vendors/deli/pickle.txt =================================================================== --- trunk/vendors/deli/pickle.txt (rev 39) +++ trunk/vendors/deli/pickle.txt 2013-01-29 20:39:17 UTC (rev 40) @@ -1 +0,0 @@ -Pickles are mostly made from cucumbers. Modified: trunk/vendors/deli/logo.jpg =================================================================== (Binary files differ) Added: trunk/vendors/deli/soda.txt ============================================================================== $
使用 --no-diff-deleted
选项可以消除有关已删除文件的输出。
$ svnlook diff -r 40 /var/svn/repos --no-diff-deleted Copied: trunk/relish.txt (from rev 39, trunk/vendors/deli/pickle.txt) =================================================================== --- trunk/relish.txt (rev 0) +++ trunk/relish.txt 2013-01-29 20:39:17 UTC (rev 40) @@ -0,0 +1 @@ +Pickle relish is mostly made from cucumbers. Modified: trunk/vendors/deli/logo.jpg =================================================================== (Binary files differ) Added: trunk/vendors/deli/soda.txt ============================================================================== $
请注意,在前面的每个示例中,当文件具有非文本 svn:mime-type
属性时,不会显式显示差异。