Is there a metadata exclusion filter for the SVN D

2019-02-05 21:42发布

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...

10条回答
The star\"
2楼-- · 2019-02-05 22:14

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

查看更多
祖国的老花朵
3楼-- · 2019-02-05 22:19

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.

查看更多
疯言疯语
4楼-- · 2019-02-05 22:20

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

查看更多
\"骚年 ilove
5楼-- · 2019-02-05 22:20

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

查看更多
放我归山
6楼-- · 2019-02-05 22:22

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

查看更多
别忘想泡老子
7楼-- · 2019-02-05 22:24

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.

查看更多
登录 后发表回答