SVN: how to compare working copy with repository r

2019-01-22 12:20发布

I want see only the list of files that have been modified, added, etc., not the content (svn diff outputs that), only the list of files like svn status.

svn diff -r HEAD dumps me tons of information, which is hard to understand quickly.

svn status shows only the changes comparing the working copy with its local original version (not with the repository revision).

svn update does not support --dry-run

Briefly, I need something like svn status, but what compares the current working copy with the repository revision (I'm going to compare with a HEAD revision).

I looked through the SVN manual, but nothing helped to me, unfortunately :-/

6条回答
趁早两清
2楼-- · 2019-01-22 12:40
svn diff -r head

This will produce a diff listing for all files which differ between the working copy and the repository, giving a list of files and the actual changes. Which, as you say, can be hard to understand.

So try this:

svn diff -r head --diff-cmd meld

This dos the same thing, but displays the changes using meld (you can provide any other visual diff tool in your arsenal), which is a lot more manageable.

But seriously, get used to reading those diff outputs, as they form the basis for so many other things (for example, patches) and are pretty hard to avoid in the Linux world. To cut down on the output:

svn status -u 

will give you a list of modified files, then:

svn diff <file> -r head --diff-cmd <tool>

will give you a visual difference of just the particular file you are interested in.

查看更多
欢心
3楼-- · 2019-01-22 12:43

Here's what I did, and it solved my problem: I want to see what's different between my working copy and the repo's copy.

svn diff > ~/svndiff.txt

And then I pulled up the plaintext file in SublimeText 2 so I could read it easier. Guess this is pretty basic stuff, but thought I'd post it since it helped me with a similar issue.

查看更多
再贱就再见
4楼-- · 2019-01-22 12:43

op:

I want see only the list of files that have been modified, added, etc., not the content (svn diff outputs that), only the list of files like svn status.

Like the OP, I want to see an "svn status" style report of the current working copy for project branches that are nested below a larger svn repository against their latest trunk and I want to use the same path and revision arguments that svn diff uses.

The following does that:

svn diff --old . --new ^/pathToProject/trunk --summarize

Of course, replace "pathToTrunk" to the actual path your repository uses.

查看更多
淡お忘
5楼-- · 2019-01-22 12:48

This may be what you are looking for:

svn diff -r HEAD --summarize

查看更多
神经病院院长
6楼-- · 2019-01-22 12:56

Try

svn status --show-updates

The -u (or --show-updates) option to svn status causes svn to contact the repository and show stuff that's changed in the repository - is that enough for you ? Depending on what you need, you might want the -q or --verbose flag too

查看更多
欢心
7楼-- · 2019-01-22 12:57

The way you worded the original question, the right answer is svn status -u as given already. Based on followup comments, you should also be aware of svn diff --summarize as this might be what you are looking for. This is what you would use to compare two repository revisions or two tags or something else in the repository. You cannot use this option to compare your working copy with the repository (status does that).

See: http://blogs.collab.net/subversion/2007/03/computing_the_d/

查看更多
登录 后发表回答