Is there a metadata exclusion filter for the SVN DIFF command?

Deadly 提交于 2019-11-29 01:07:51

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

Joe Watkins

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.

Justin Ryder

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

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 :/

Brian Kirwan

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.

seanahern

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

Peter Mortensen

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!