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 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.

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 and TARGET@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

  1. --change (-c) ARG
  2. --changelist ARG
  3. --depth ARG
  4. --diff-cmd CMD
  5. --extensions (-x) ARG
  6. --force
  7. --new ARG
  8. --no-diff-deleted
  9. --notice-ancestry
  10. --old ARG
  11. --revision (-r) ARG
  12. --summarize
  13. --xml

Examples

Compare BASE and your working copy (one of the most popular uses of svn diff):

  1. $ svn diff COMMITTERS
  2. Index: COMMITTERS
  3. ===================================================================
  4. --- COMMITTERS (revision 4404)
  5. +++ COMMITTERS (working copy)

See what changed in the file COMMITTERS revision 9115:

  1. $ svn diff -c 9115 COMMITTERS
  2. Index: COMMITTERS
  3. ===================================================================
  4. --- COMMITTERS (revision 3900)
  5. +++ COMMITTERS (working copy)

See how your working copy's modifications compare against an older revision:

  1. $ svn diff -r 3900 COMMITTERS
  2. Index: COMMITTERS
  3. ===================================================================
  4. --- COMMITTERS (revision 3900)
  5. +++ COMMITTERS (working copy)

Compare revision 3000 to revision 3500 using “@” syntax:

  1. $ svn diff http://svn.collab.net/repos/svn/trunk/COMMITTERS@3000 \
  2. http://svn.collab.net/repos/svn/trunk/COMMITTERS@3500
  3. Index: COMMITTERS
  4. ===================================================================
  5. --- COMMITTERS (revision 3000)
  6. +++ COMMITTERS (revision 3500)

Compare revision 3000 to revision 3500 using range notation (pass only the one URL in this case):

  1. $ svn diff -r 3000:3500 http://svn.collab.net/repos/svn/trunk/COMMITTERS
  2. Index: COMMITTERS
  3. ===================================================================
  4. --- COMMITTERS (revision 3000)
  5. +++ COMMITTERS (revision 3500)

Compare revision 3000 to revision 3500 of all the files in trunk using range notation:

  1. $ 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:

  1. $ svn diff -r 3000:3500 --old http://svn.collab.net/repos/svn/trunk \
  2. COMMITTERS README HACKING

If you have a working copy, you can obtain the differences without typing in the long URLs:

  1. $ svn diff -r 3000:3500 COMMITTERS
  2. Index: COMMITTERS
  3. ===================================================================
  4. --- COMMITTERS (revision 3000)
  5. +++ COMMITTERS (revision 3500)

Use --diff-cmd CMD --extensions (-x) to pass arguments directly to the external diff program:

  1. $ svn diff --diff-cmd /usr/bin/diff -x "-i -b" COMMITTERS
  2. Index: COMMITTERS
  3. ===================================================================
  4. 0a1,2
  5. > This is a test
  6. >

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:

  1. $ svn diff --summarize --xml http://svn.red-bean.com/repos/test@r2 \
  2. http://svn.red-bean.com/repos/test
  3. <?xml version="1.0"?>
  4. <diff>
  5. <paths>
  6. <path
  7. props="none"
  8. kind="file"
  9. item="modified">http://svn.red-bean.com/repos/test/sandwich.txt</path>
  10. <path
  11. props="none"
  12. kind="file"
  13. item="deleted">http://svn.red-bean.com/repos/test/burrito.txt</path>
  14. <path
  15. props="none"
  16. kind="dir"
  17. item="added">http://svn.red-bean.com/repos/test/snacks</path>
  18. </paths>
  19. </diff>

SVN diff的更多相关文章

  1. svn diff 详解

    UI版: 如果多人编辑同一段代码,常常容易出现冲突的情况: 如果出现冲突,我们如何解决他呢? 1 可以选择使用自己的文件mime file,也可以使用 他们的文件 their file 2 解决冲突, ...

  2. Mac、Linux更换命令行svn diff为P4Merge、vimdiff

    2015-01-21 21:25:52 这里先把那个程序员大神的博客地址贴一下(PS:大神,我不是为了抄袭哦,真是怕自己忘记了),http://www.ccvita.com/445.html,里面还有 ...

  3. 如何使用 vimdiff 来 git diff /svn diff

    #git 如何实现vimdiffgit config --global diff.tool vimdiff git config --global difftool.prompt false git ...

  4. svn小技巧——重定向svn diff

    svn diff的默认输出模式比较冗长,如果遇到修改比较多的情况,有时会较难看清diff.svn本身提供了自定义diff输出的选项,可能的修改方法如下: 建立一个脚本文件(如svndiff.sh),调 ...

  5. [转]svn diff 替代工具

    svn diff 替代工具 http://blog.csdn.net/fudesign2008/article/details/8168811 一. 使用vimdiff替换svn diff: 对于多数 ...

  6. SVN diff 笔记

    SVN diff命令在实际中经常使用,在此记录使用点滴. #对比工作文件与缓存在.svn的“原始”拷贝: svn diff #显示工作文件和服务器版本2的不同: svn diff -r 2 #显示分支 ...

  7. svn diff color

    大致有两种方式: 1,在bashrc中添加如下脚本 svndiff() { svn diff "${@}" | colordiff } 2,修改svn的配置文件 $ vim ~/. ...

  8. 使用svn diff的-r参数的来比较任意两个版本的差异

    1 svn diff的用法1.1 对比当前本地的工作拷贝文件(working copy)和缓存在.svn下的版本库文件的区别 svn diff 1.2 对比当前本地的工作拷贝文件(working co ...

  9. learning svn diff --summarize

    # svn diff --summarizeA armbian-custom-dc/test/4g-power.shA armbian-custom-dc/test/4g-reset.shM armb ...

  10. svn diff 只显示文件名

    svn diff   --summarize

随机推荐

  1. Pytest系列(2) - assert断言详细使用

    如果你还想从头学起Pytest,可以看看这个系列的文章哦! https://www.cnblogs.com/poloyy/category/1690628.html 前言 与unittest不同,py ...

  2. MATLAB 动图绘制、保存

    动图有gif格式和视频的avi格式. 1.sin(x)动图 clear all h = animatedline;%动画线 axis([0 4*pi -1 1]) box on x = linspac ...

  3. python之xlrd和xlwt模块读写excel使用详解

    一.xlrd模块和xlwt模块是什么      xlrd模块是python第三方工具包,用于读取excel中的数据:      xlwt模块是python第三方工具包,用于往excel中写入数据: 二 ...

  4. Java并发基础01. 传统线程技术中创建线程的两种方式

    传统的线程技术中有两种创建线程的方式:一是继承Thread类,并重写run()方法:二是实现Runnable接口,覆盖接口中的run()方法,并把Runnable接口的实现扔给Thread.这两种方式 ...

  5. ajax使用POST提交报错400

    并非BadRequest!! 在用ajax访问登录接口的时候出现了这个错误,查阅得到使用Ajax的Post需要添加 contentType: "application/x-www-form- ...

  6. Java8 新特性 Lambda & Stream API

    目录 Lambda & Stream API 1 Lambda表达式 1.1 为什么要使用lambda表达式 1.2 Lambda表达式语法 1.3 函数式接口 1.3.1 什么是函数式接口? ...

  7. 批处理 bat 查询局域网内在线电脑IP

    查看自己局域网的IP和物理网卡地址可以在 WIN+R –> 打开cmd 键入 arp -a 可以看到局域网中所有的在线IP COLOR 0A CLS @ECHO Off Title 查询局域网内 ...

  8. 模板继承和UImodul 和 UImethods

     模板继承和UImodul 和 UImethods 模板的继承 {% extends path %} path为templates下的相对路径 {% block block_name %}conten ...

  9. Mac PyCharm之.gitignore 安装设置

    1. 首先安装.ignore 点击 PyCharm >>> Preferences 点击Plugins >>> 在搜索框输入.ignore >>> ...

  10. "为文本添加下划线"组件:<u> —— 快应用组件库H-UI

     <import name="u" src="../Common/ui/h-ui/text/c_tag_underline"></impor ...