11

What is the SVN command to find the difference between two files on the hard disk (neither of which are in the repository)?

What is the command to find if one of the file is in a particular revision of SVN?

What are some of the cool things you do using SVN commands?

0

5 Answers 5

16

You don't use SVN to diff files that aren't in the repository. If you are using linux then use the command:

diff file1 file2 

If you are using Windows then try a tool like win merge for example

To find information about a file in the repository then use the command:

svn info file 

If you want to find out more about SVN, have a look at the official tutorial.

Sign up to request clarification or add additional context in comments.

1 Comment

Windows can use FC to compare files. Use FC /? for more details.
12

svn diff --old foo.c --new bar.c

3 Comments

Hi, welcome to SO. Could you please provide an explanation for your answer?
awesome! Works great! Should be the accepted answer
Yes I agree with Denis, this is the answer that also helped me out.
7

In TortoiseSVN you can diff two arbitrary files. Just select them both and choose diff in contextmenu of tortoiseSVN. However, they have to be in same directory, otherwise TSVN will not show up diff command. In this case you can use helper tools TortoiseIDiff.exe and TortoiseMerge.exe which are part of TortoiseSVN and are inside TSVN_installation/bin folder

Comments

2

Answers:

  1. There is none, SVN can compare between repository versions for a target (ie. rev 1 and rev 3 of a particular file) or between working copy version and last checked out version, or working copy and repository versions

  2. Depends on what you mean by that. If the file has been added, you can check the log for the file for the given revision, like this:

    svn log filename@revnumber

for instance, check the log of TestFile.txt in revision 2:

svn log TestFile.txt@2 

if it outputs a log, there was a file by that name in revision 2, otherwise it wasn't.

However, that won't tell you whether or not the file you currently have in the working copy is the same file as the one you checked the log of (ie. if you deleted the file in an earlier revision, and then added a new file with the same name, it isn't the same file, lifetime-wise, but it is a file with the same name in the same location).

As for the third question, can you be more specific?

Comments

0

Just a supplement for @Richard Kirby answer as I can't comment for low reputation.

"svn diff --old foo.c --new bar.c"

This command works perfectly to make diff between two local files. Except that, it could also be used to compare the diff between two files specified with SVN subversion URL. It will be something like: svn diff --old https://repository/file1 --new https://repository/file2

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.