简体   繁体   English

如何在工作副本和任意转发之间找到svn diff?

[英]How can I find the svn diff between working copy and arbitrary rev?

I'm trying to write a multi-file patch for an open-source project, but the master copy has changed since I started working. 我正在尝试为开源项目编写一个多文件补丁,但自从我开始工作以来,主副本已经改变了。 I need to get the SVN difference (just the files under version control) between my uncommitted version and the revision from which it was checked. 我需要在我的未提交版本和检查它的版本之间获得SVN差异(只是版本控制下的文件)。 Which SVN command can I use to find the difference? 我可以使用哪个SVN命令来查找差异?

Edit: I'm sorry, I must have been using the term "working copy" improperly. 编辑:对不起,我一定是不正当地使用“工作副本”一词。 I need to compare my uncommitted changes to the revision off which they are based. 我需要将我未提交的更改与它们所基于的修订版进行比较。 In other words, I checked out revision 1000 and changed files foo and bar . 换句话说,我检查了修订版1000并更改了文件foobar The rev number is now up to 1015, but I need to compare my version of foo and bar to the version of revision 1000. Is there an easy command to do this (compare my altered copy of a program with a past revision)? 转数现在高达1015,但我需要将我的foobar版本与版本1000的版本进行比较。是否有一个简单的命令来执行此操作(将我修改的程序副本与过去的修订版进行比较)?

You can use -rN:M parameter with diff command which specifies the revisions you want to compare. 您可以在diff命令中使用-rN:M参数,该命令指定要比较的修订。 Just provide revision from which your working copy was checked out (you can omit M as it defaults to working copy) and you should get what you need. 只提供您的工作副本签出的修订版(您可以省略M,因为它默认为工作副本),您应该得到您需要的。

If you don't remember the original revision number try to run svn status -v and first column should show it. 如果您不记得原始版本号,请尝试运行svn status -v ,第一列应显示它。

More info svn help diff ... 更多信息svn help diff ...

svn diff takes a -rN:M argument which defaults to N == BASE and M == working copy . svn diff采用-rN:M参数,默认为N == BASEM == working copy Will svn diff -r REV where REV is the revision you want not work? svn diff -r REV哪里REV是你想要的修改版?

To answer your edit, suppose you have the following: 要回答您的编辑,假设您有以下内容:

$ ls
foo bar baz
$ svn st -u
Status against revision:    1071
$ echo "more stuff" >> foo
$ svn diff -r 1000 foo
Index: foo
===================================================================
--- foo  (revision 1000)
+++ foo  (working copy)
...

I believe this is what you are after, yes? 我相信这就是你所追求的,是吗?

如果您的目标是仅获取内容已更改的文件名的报告,则应该这样做:

svn diff | grep 'Index: ' .

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM