SVN diff
http://svnbook.red-bean.com/en/1.6/svn.ref.svn.c.diff.html
Name
svn diff (di) — This displays the differences between two revisions or paths.
Synopsis
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]
Description
Display the differences between two paths. You can use svn diff in the following ways:
Use just svn diff to display local modifications in a working copy.
Display the changes made to
TARGET
s as they are seen inREV
between two revisions.TARGET
s may be all working copy paths or allURL
s. IfTARGET
s are working copy paths,N
defaults toBASE
andM
to the working copy; ifTARGET
s areURL
s,N
must be specified andM
defaults toHEAD
. The-c M
option is equivalent to-r N:M
whereN = M-1
. Using-c -M
does the reverse:-r M:N
whereN = M-1
.Display the differences between
OLD-TGT
as it was seen inOLDREV
andNEW-TGT
as it was seen inNEWREV
.PATH
s, if given, are relative toOLD-TGT
andNEW-TGT
and restrict the output to differences for those paths.OLD-TGT
andNEW-TGT
may be working copy paths orURL[@REV]
.NEW-TGT
defaults toOLD-TGT
if not specified.-r N
makesOLDREV
default toN
;-r N:M
makesOLDREV
default toN
andNEWREV
default toM
.
svn 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
is shorthand for svn diff -r N:M --old=URL --new=URL
.
svn diff [-r N[:M]] URL1[@N] URL2[@M]
is shorthand for 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
(-r
) option or by using the “@” notation as described earlier.
If TARGET
is a working copy path, the default behavior (when no --revision
(-r
) option is provided) is to display the differences between the base and working copies of TARGET
. If a --revision
(-r
) option is specified in this scenario, though, it means:
--revision N:M
-
The server compares
TARGET@N
andTARGET@M
. --revision N
-
The client compares
TARGET@N
against the working copy.
If the alternate syntax is used, the server compares URL1
and URL2
at revisions N
and M
, respectively. If either N
or M
is omitted, a value of HEAD
is assumed.
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 (i.e., 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).
Options
--change (-c) ARG
--changelist ARG
--depth ARG
--diff-cmd CMD
--extensions (-x) ARG
--force
--new ARG
--no-diff-deleted
--notice-ancestry
--old ARG
--revision (-r) ARG
--summarize
--xml
Examples
Compare BASE
and your working copy (one of the most popular uses of svn diff):
$ svn diff COMMITTERS
Index: COMMITTERS
===================================================================
--- COMMITTERS (revision 4404)
+++ COMMITTERS (working copy)
See what changed in the file COMMITTERS
revision 9115:
$ svn diff -c 9115 COMMITTERS
Index: COMMITTERS
===================================================================
--- COMMITTERS (revision 3900)
+++ COMMITTERS (working copy)
See how your working copy's modifications compare against an older revision:
$ svn diff -r 3900 COMMITTERS
Index: COMMITTERS
===================================================================
--- COMMITTERS (revision 3900)
+++ COMMITTERS (working copy)
Compare revision 3000 to revision 3500 using “@” syntax:
$ 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
Compare revision 3000 to revision 3500 of only three files in trunk
using range notation:
$ svn diff -r 3000:3500 --old http://svn.collab.net/repos/svn/trunk \
COMMITTERS README HACKING
If you have a working copy, you can obtain the differences without typing in the long URLs:
$ svn diff -r 3000:3500 COMMITTERS
Index: COMMITTERS
===================================================================
--- COMMITTERS (revision 3000)
+++ COMMITTERS (revision 3500)
Use --diff-cmd
CMD
--extensions
(-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>
SVN diff的更多相关文章
- svn diff 详解
UI版: 如果多人编辑同一段代码,常常容易出现冲突的情况: 如果出现冲突,我们如何解决他呢? 1 可以选择使用自己的文件mime file,也可以使用 他们的文件 their file 2 解决冲突, ...
- Mac、Linux更换命令行svn diff为P4Merge、vimdiff
2015-01-21 21:25:52 这里先把那个程序员大神的博客地址贴一下(PS:大神,我不是为了抄袭哦,真是怕自己忘记了),http://www.ccvita.com/445.html,里面还有 ...
- 如何使用 vimdiff 来 git diff /svn diff
#git 如何实现vimdiffgit config --global diff.tool vimdiff git config --global difftool.prompt false git ...
- svn小技巧——重定向svn diff
svn diff的默认输出模式比较冗长,如果遇到修改比较多的情况,有时会较难看清diff.svn本身提供了自定义diff输出的选项,可能的修改方法如下: 建立一个脚本文件(如svndiff.sh),调 ...
- [转]svn diff 替代工具
svn diff 替代工具 http://blog.csdn.net/fudesign2008/article/details/8168811 一. 使用vimdiff替换svn diff: 对于多数 ...
- SVN diff 笔记
SVN diff命令在实际中经常使用,在此记录使用点滴. #对比工作文件与缓存在.svn的“原始”拷贝: svn diff #显示工作文件和服务器版本2的不同: svn diff -r 2 #显示分支 ...
- svn diff color
大致有两种方式: 1,在bashrc中添加如下脚本 svndiff() { svn diff "${@}" | colordiff } 2,修改svn的配置文件 $ vim ~/. ...
- 使用svn diff的-r参数的来比较任意两个版本的差异
1 svn diff的用法1.1 对比当前本地的工作拷贝文件(working copy)和缓存在.svn下的版本库文件的区别 svn diff 1.2 对比当前本地的工作拷贝文件(working co ...
- learning svn diff --summarize
# svn diff --summarizeA armbian-custom-dc/test/4g-power.shA armbian-custom-dc/test/4g-reset.shM armb ...
- svn diff 只显示文件名
svn diff --summarize
随机推荐
- RecyclerView的刷新分页
在开发中常常使用到刷新分页,这里实现一个 RecyclerView 的简单的刷新分页操作,测试效果见文末,实现过程参考如下: 实现思路 加载更多数据使用到 RecyclerView 加载多种布局,根据 ...
- Java是未来的第一编程语言吗?
目录 一.前言 二.Java帝国的今天 2.1 依然霸占TIOBE热门编程语言的榜首 2.2 曾经想扼杀Java的微软宣布加入OpenJDK 2.3 Oracle发布开源全栈虚拟机GraalVM 三. ...
- 利用data文件恢复MySQL数据库
背景:测试服务器 MySQL 数据库不知何种原因宕机,且无法启动,而原先的数据库并没有备份,重新搭建一个新服务器把原data 复制出来 进行恢复 1 尽量把原data复制出来(一个都不要少以防意外 其 ...
- 国内 Java 开发者必备的两个装备,你配置上了么?
虽然目前越来越多的国产优秀技术产品走出了国门,但是对于众领域的开发者来说,依然对于国外的各种基础资源依赖还是非常的强.所以,一些网络基本技能一直都是我们需要掌握的,但是速度与稳定性问题一直也都有困扰着 ...
- Spring Boot入门系列(十)如何使用拦截器,一学就会!
前面介绍了Spring Boot 如何整合定时任务已经Spring Boot 如何创建异步任务,不清楚的朋友可以看看之前的文章:https://www.cnblogs.com/zhangweizhon ...
- 用curl调用https接口
今天在windows下用curl类获取微信token一直返回false,查阅资料后,发现是https证书的锅,在curl类中加上这两条,问题瞬间解决. curl_setopt($ch, CURLOPT ...
- 如何使你的PPT更高调
PPT是什么? 俗话说的好,PPT就是"屁屁踢"/笑脸. PPT是微软office三件套之一,也就是演示文稿,用于演示(说了给没说一样). PPT的用途 视觉辅助 自动演示 阅读 ...
- 关于Linux目录的配置
关于Linux目录的配置说明 大家都知道Linux一切皆文件,但是Linux的文件有那么多,目录也不少.他们都是干什么用的呢,有没有什么规律呢?今天我们就来讨论一下Linux目录的配置 Linux目录 ...
- C语言输出 1到20 的阶乘之和
除了调用库,绝对找不到比这更精简的代码了. #include<stdio.h> #include<string.h> long long getdata(long long n ...
- Linux服务器 上传/下载 文档/目录
1.从服务器上下载文件 scp username@servername:/path/filename /var/www/local_dir(本地目录) 例如scp root@192.168.0.101 ...