开发者

SVN: how to compare working copy with repository revision?

开发者 https://www.devze.com 2023-02-08 22:14 出处:网络
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.

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 开发者_JAVA技巧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.


This may be what you are looking for:

svn diff -r HEAD --summarize


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消