Question

I use SVN as the source control system, and I wonder how to compare directories while ignoring any metadata differences. Is there a way to tell svn diff to compare only the actual content and ignore any metadata?

I mean metadata like SVN properties, etc. that don't affect the file content. Assume file X has an additional property in branch B compared to trunk T. Unfortunately it will show up in 'svn diff T B' even though the actual content of file X is the same.

I look for something like this:

svn diff https://example.org/tags/v1 https://example.org/tags/v2 -x -ignore-metadata --summarize

Update: I partially solved this by diff'ing directly on the filesystem instead of using the SVN tools. See my own answer below...

Was it helpful?

Solution 5

There seems to be no way to get this done using the svn built-in tools. How I solved it: Export both trees and diff them diretly on the filesystem using your favourite diff tool. That's somehow the only way to get this done :/

OTHER TIPS

You can pass the svn diff output through 'filterdiff --clean' to remove any extraneous lines including property changes.

If you use the --summarize option, then property changes are indicated in the second rather than the first column.

I.e.,

M  URL  -- indicates content change
 M URL  -- property change
MM URL  -- content and property change

It is a bit easier to grep. I guess you could have a two-stage process if you want a full diff - first use summarize to find files with content change, then diff them.

Nice tip from JosephWatkins.

Here is the command for the grep-junior-users:

svn diff A B --summarize | grep '^. '

The grep looks for a space as the second character on the line.

Found this while searching through the svn help docs

svn diff --patch-compatible

It's the same as running

svn diff --show-copies-as-adds --ignore-properties

Here's a single command that does all this. Say you want to find all (non-property) diffs for all files in the currently directory between revision 54833 and 57215. This command should do it:

svn diff -r 54833:57215 --summarize | egrep -v '^ |^D|^A' | awk '{ print $2 }' | xargs svn diff -r 54833:57215

NB: It only diffs modified files - not added or deleted files.

Use svn diff --ignore-properties. That's Subversion's built-in method to do differencing of the content only. It ignores any changes to the properties of the items.

I wrote a script to do this, after I couldn't find one online.

The script removes the data based on an array of regular expressions entered at the top of the script. Currently, it is set up to filter out the properties changes, but it can remove any change that matches a series of regular expressions.

Just pipe the output of svn diff to the script, after you set the script. I put the filters in the script instead of parameters because I always run the same filters.

I released it as GPLv2.

clean_svn_diff.bash

I'm not sure, but a simple 'svn diff | grep -iv "stuff to ignore"' would be a workaround.

You can set the svn:ignore property on files and directories you want svn diff to ignore.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top