See difffilter -h.

This program is meant to filter out different files from unified diffs. It is to be used as a traditional filter, with unified diff data coming on stdin and the result being written to stdout. Any arguments are treated as POSIX Extended Regular Expressions. If a file mentioned by a diff header matches the any regex, that portion of the diff is not written to STDOUT.

Example usage (using mercurial to filter out bad changes from commitdiffs):
cd good-repo
hg -R ../bad-repo diff export 1 | difffilter '^configure$' '^config\.(status|log|sub|guess)' '(^|/)Makefile\.in$' '\.o$' | hg import -
