本手册旨在描述 Apache™ Subversion® 的 1.7.x 系列。如果您运行的是其他版本的 Subversion,强烈建议您访问 https://svnbook.subversion.org.cn/ 并查阅适合您 Subversion 版本的文档。

名称

svnlook diff — 打印更改的文件和属性的差异。

概要

svnlook diff REPOS_PATH

描述

打印存储库中更改的文件和属性的 GNU 风格差异。

选项

示例

这将显示一个新添加的(空的)文件、一个修改的二进制文件和一个重命名(即复制和删除)的文件,其中包含修改。

$ 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 属性时,差异不会显式显示。

TortoiseSVN 官方中文版 1.14.7 发布