开发者

Edit diff files

I have a .diff file generated from comparing two directories. However, there are some folders and files that appe开发者_开发知识库ar in the .diff that I want to remove from it, so I can get a cleaner .diff.

Is there any editor that lets me do this (something like Kompare, but it must allow to remove files from the diff)? How can I specify to exclude specific directories?


It's not an editor, but it looks as if filterdiff from patchutils does what you're after:

Filterdiff will select the portions of a patch file that apply to files matching (or, alternatively, not matching) a shell wildcard.

You can find out more about patchutils here and it's packaged in Debian / Ubuntu as "patchutils".


If you end up needing to do "real editing" of patch (diff) files, like adding and removing diffs, adding and removing lines from a diff, etc then you might consider running Emacs which has a diff-editing mode that does the "right thing" when you go changing a diff file. It has menu actions and key bindings for "kill current chunk" and similar actions.


Have you tried Meld? There you can define filters to filer your comparisons. Otherwise it's a perfect GUI for diff.


If you have control over the creation of the .diff file, I think the best approach is to in the first place not include what you later want to ignore. Diff have a --exclude-from=FILE command line option where you can give it a list of all files you want to have excluded. Alternatively you can use --exclude=PATTERN to exclude based on file name matching.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜