简体   繁体   中英

SVN: how to compare working copy with repository revision?

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 (I'm going to compare with a HEAD revision). 进行比较(我将与HEAD修订版进行比较)。

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

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

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.

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/

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.

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.

This may be what you are looking for:

svn diff -r HEAD --summarize

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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