tags:

views:

75

answers:

3

How can I test if a file is identical in all branches that it exists in?
Even pseudocode to build a script would be helpful.

Thanks.

EDIT: I had to perform this operation on about 900 files across 5 branches. Long story.
It turns out the easiest thing to do was to just check everything out, and use standard command line tools to do the job.

Thanks everyone for your suggestions.

+1  A: 

Here is an article on diffing between branches

http://www.murrayc.com/blog/permalink/2007/01/25/subversion-diff-between-branches/

phsr
+2  A: 

Something like the following?

foreach( branch in project/branches/* )
  svn diff project/trunk/relative_path_to_file branch/relative_path_to_file
sbi
+1  A: 

The easiest (and fastest) way is to compare the revision numbers of the files, as branching and tagging will not change them.

If you follow this path, you are not checking for identity, but if file was changed in branch, which usually is more important.

So it will report a false alarm, if somebody commit a changed to a file and later reverse merge it back to the old revision. To avoid this, you can diff files which have a non-matching revision.

You can get the revision numbers of all files in head revision by

svn ls -vR REPO_URL/path/to/file

or in nice xml by:

svn ls --xml -R REPO_URL/path/to/file

If you know,that the path to the file(relative from trunk) is unique in the whole repository, you can use grep for getting all branched files:

svn ls -vR REPO_URL/ | grep /path/to/file/without/trunk

Then you have all infos there and just need parsing..(but svn ls -vR REPO_URL/ is really slow)

Peter Parker
I guess this should work if the same file was added in 2 branches separately, right? Thanks.
z5h
Not then this will report a diofference(as revision is not same) also this is usually not the correct way and merging with svn will be difficult
Peter Parker
Yes, I know. It was/is a mess. I had to patch svn with a diff from the svn developers to get svn to merge the various branches without crashing.
z5h