3

TL;DR: How can I automatically apply PrediffLineFilter on all diff results, not manually on only the open file?

WinMerge 2.16.4.0 supports using plugin prediffers to, among things, diff while ignoring items that meet conditions specified with a regular expression*. However it appears you must manually apply the prediff after you perform the diff (huh?) and on each and every individual file if it doesn't match a file filter. The help manual indicates the file filter for PrediffLineFilter.sct is *.txt and gives no guide to changing it.

I have thousands of files where the only difference might be a server name which follows a predictable pattern. (Example: server01, server02, etc.) I have figured out the regex for that pattern and the manual application of PrediffLineFilter after a diff works. But I can't be doing that on thousands of files.

How can I automatically apply PrediffLineFilter on all diff results, not manually on only the open file? I only want to see the files where the differences are meaningful.

*Learned this thanks to WinMerge : how to ignore specific words in a comparison?

Neman
  • 157
  • 1
  • 11
  • I am having this issue too. It works on files with only a few lines but doesn't work on files with about 100 lines. – jaypax123 Mar 02 '21 at 10:36

1 Answers1

1

In your winmerge installation folder, go to MergePlugins then edit the PrediffLineFilter.sct. Then change the return of get_PluginFileFilters to files you want this plugin to work on. For example you want this plugin to work on html and txt files:

Function get_PluginFileFilters()
    get_PluginFileFilters = "\.html$;\.txt$"
End Function

After you have made these changes, select all the files on your folder compare window then right click > Plugin Settings > Prediffer Settings > Auto Prediffer, then refresh. Btw, in the later versions(2.16.10) you can do this in the Plugin Settings window.

enter image description here

jaypax123
  • 188
  • 2
  • 14
  • To get it working, I had one more step: enabling Plugins > Automatic Prediffer. After this, files that matched my filemask of \.xml$;\.config$ and containing text that matched my regexex in Plugins > Plugin Settings... > PrediffLineFilter.sct > Plugin Settings were correctly treated as identical. (A reminder/warning that if the regex matches even a single word in the line, the whole line is ignored - that's just how line filters work as per the very top of https://manual.winmerge.org/en/Filters.html.) Thank you! – Neman Apr 26 '21 at 23:56