[译]WinFiltDiff,用于过滤不重要的源差异的实用程序
By robot-v1.0
本文链接 https://www.kyfws.com/applications/winfiltdiff-a-utility-to-filter-out-unimportant-so-zh/
版权声明 本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!
- 8 分钟阅读 - 3897 个词 阅读量 0[译]WinFiltDiff,用于过滤不重要的源差异的实用程序
原文地址:https://www.codeproject.com/Articles/9395/WinFiltDiff-a-utility-to-filter-out-unimportant-so
原文作者:Chris Forden
译文由本站 robot-v1.0 翻译
前言
A utility to filter out unimportant source-differences.
一个实用程序,用于过滤不重要的源差异.
介绍(Introduction)
WinFiltDiff 1.1是一种工具,可用于过滤到WinDiff的输入,因此WinDiff不会将您不关心的文件的输出弄乱.您可以使用WinFiltDiff禁止显示有关中间文件的WinDiff条目,例如(WinFiltDiff 1.1 is a tool that allows you to filter the input to WinDiff so WinDiff does not clutter its output with files you do not care about. You can use WinFiltDiff to suppress WinDiff entries about intermediate files like).obj(.obj*)*文件.它可以抑制由于Visual Source Safe(VSS)关键字的扩展扩展而引起的差异,因此如下所示:(*files. It can suppress differences due to varying expansions of Visual Source Safe (VSS) keywords, so the likes of:*)
$Archive: /RunWinFiltDiff/DirComparer.h $
$Author: Chris.forden $
$Date: 12/29/04 7:48p $
对文件的明显差异没有影响.您还可以排除编译器生成的文件,这些文件的第一行包含固定的编译器生成的消息.这些功能允许您从比较中排除所有COM生成的标头和中间文件(如果选择).(have no effect on the apparent differences in files. You can also exclude compiler-generated files that contain fixed compiler-generated messages in their first lines. These features allow you to exclude all the COM-generated headers and intermediate files from comparisons, if you choose.)
WinFiltDiff通过仅将具有明显差异的文件复制到输出目录中您可以选择的位置(通常是临时目录)中来实现此目的.然后,WinFiltDiff在这些复制的文件上运行WinDiff.这样可以有效地过滤到WinDiff的输入.(WinFiltDiff accomplishes this by copying only files with significant differences to output directories in a location you can choose – typically a temp directory. Then WinFiltDiff runs WinDiff on those copied files. This effectively filters the input to WinDiff.)
您还可以选择包含以下内容的目录(You can also choose a directory that contains).文本(.txt*)*描述WinFiltDiff用于排除文件的规则的文件.您可以使用文本编辑器编辑这些规则,并创建其他排除规则目录,您可以从WinFiltDiff的GUI的下拉组合框中方便地选择这些目录.(*files that describe the rules WinFiltDiff uses to exclude files. You can edit those rules with a text editor and create alternative exclusion-rule directories which you can conveniently choose from within a drop-down combo box in WinFiltDiff’s GUI.*)
由于仅将具有差异的文件复制到WinDiff检查的目录中,因此WinDiff无法显示丢失的文件.因此,WinFiltDiff会在其输出目录中生成丢失文件的列表.(Since only files with differences get copied to the directories that WinDiff checks, WinDiff cannot reveal missing files. Therefore, WinFiltDiff generates a list of missing files in its output directory.)
我重新使用了Chris Maunder的RunWinDiff GUI代码来创建WinFiltDiff.(I re-used Chris Maunder’s RunWinDiff GUI code to create WinFiltDiff.)
只要您通过列出我的姓名和贡献给我功劳,我即会授予您使用我的修改的许可.要使用此代码,您必须对错误和遗漏承担全部责任;由于我们免费提供,因此无法对其进行全面测试.(I grant permission to use my modifications as you wish, as long as you give me credit by listing my name and contribution. To use this code, you must accept all responsibility for errors and omissions; since we provide it for free, we cannot test it thoroughly.)
使用细节(Usage Details)
您需要在WinDiff中保持"忽略空白"选项,以便忽略(You will need to keep the “ignore blanks” option on in WinDiff in order to ignore)$关键字:扩展$($keyword: expansions $*)*因为WinFiltDiff将空格附加到文件的末尾,以便在将它们复制到其输出目录时使它们具有相同的大小.(because WinFiltDiff appends blanks to the ends of files in order to make them have the same size when it copies them to its output directories.)
通配符(例如:" ")在排除文件中没有非文字效果.(Wild cards (e.g.: “") have no non-literal effect in the exclusion files.)
WinFiltDiff永远不会删除其临时输出,因此最终必须手动删除它们.但是,将输出保持一小会儿可能很方便.通常,输出目录仅包含最近更改的源文件,因此磁盘使用总量很小. WinFiltDiff创建一个名为的子目录(WinFiltDiff never deletes its temporary output, so you will have to eventually delete them manually. However, it might be convenient to keep the output around for a little while; typically, the output directories only hold recently changed source files, so the total disk-usage is minimal. WinFiltDiff creates a subdirectory called)\ Diff (\Diff*)在您在GUI中选择的临时目录或其他输出目录中.再次运行WinFiltDiff时,它将移动其先前的输出((in the temporary or other output directory you choose in the GUI. When you run WinFiltDiff again, it moves its previous output ()\ Diff \ .(\Diff*.**))放入一个编号子目录() into a numbered subdirectory inside)\ Diff上一页(\Diff Prev*).(.*)
GUI从RunWinDiff更改(GUI changes from RunWinDiff)
我将目录/文件选择器组合框扩大了很多,因为我们现在有了更宽的(高分辨率)屏幕,并且;现在我们可以看到完整的路径名,即使它很长.我为该应用程序添加了一个图标,因此可以从任务栏或Alt-选项卡中进行选择.我使"选择文件夹"图标看起来像一个文件夹.尽管” …“图标是标准的,但我认为在选择文件和选择文件夹之间进行区分会有所帮助.我在选择组合框的文件/目录中添加了一些颜色,以指示WinDiff将与之关联的颜色.(I made the directory/file chooser combo boxes much wider because we now have wider (hi-res) screens and; now we can see the full path-name, even if it is long. I added an icon for the app, so it can be chosen from the task-bar or Alt-tab. I made the Choose Folder icon look like a folder; although the “…” icon is standard, I thought a distinction between choosing files and choosing folders would be helpful. I added some color to the file/directory choosing combo boxes to indicate the color that WinDiff would associate them with.)
未来的可能性(Future Possibilities)
希望允许用户选择WinDiff以外的其他视觉比较工具.在排除目录中创建一个文件,该文件允许用户排除整个目录(例如,"(Allowing the user to choose other visual comparison tools besides WinDiff would be desirable. Creating a file in the exclusions directory that would allow the user to exclude whole directories (e.g., “)\调试(\Debug*)")将节省运行时间,并消除WinFiltDiff现在在temp目录中创建的空文件夹.我计划有一个文件,"(") would save runtime and eliminate empty folders that WinFiltDiff now creates in the temp directory. I was planning to have a file, “)排除项\ AnywhereInPathName.txt(Exclusions\AnywhereInPathName.txt)",那样就可以了.我以” CList …“开头的形式抽象了WinFiltDiff类层次结构中的功能.(”, that would do that. I abstracted the functionality in the hierarchy of WinFiltDiff classes beginning with “CList…” so additional*)*.文本(*.txt*)*具有排除规则的文件可以轻松添加.(*files with exclusion rules could be easily added.*)
能够排除仅在其注释中具有更改的文件将很有用.排除仅在空格中有更改的文件(包括换行符)会很有用. WinDiff本身可以排除多余的制表符和空格的添加和删除,但不能忽略换行符.(It would be useful to be able to exclude files that had changes only in their comments. It would be useful to exclude files that only had changes in whitespace, including new-lines. WinDiff itself can exclude additions and deletions of extra tabs and blanks, but cannot ignore new-line characters.)
也许一个不错的附加排除列表将是成对的新旧令牌,这样也将排除其唯一变化是将一个指定的旧令牌替换为其对应的指定的新令牌的文件.(Maybe a nice additional exclusion list would be pairs of new/old tokens such that files whose only changes were the substitution of one specified old token with its corresponding specified new token would also be excluded.)
也许有一天,我将添加这些功能.但是,不要屏住呼吸.(Maybe someday, I will add these capabilities. Don’t hold your breath, though.)
1.1中修复的bug困扰着1.0(Bugs Fixed in 1.1 that plagued 1.0)
通常无法创建输出目录.(The output directory often could not be created.)
“即时检查"实时显示有时会在路径名中显示双斜杠.(The “Now Checking” real-time display would sometimes show a double-slash in the path-name.)
的(The)*温度/差异/上一个(Temp/Diff/Prev)*运行WinFiltDiff时,文件夹具有无限的嵌套.最终,这将导致该文件夹不可删除.现在,以前的临时文件没有放在(folder got an unlimited nesting as you ran WinFiltDiff. Eventually, that will cause the folder to be undeletable. Now the previous temp files are not placed in a hierarchy of)*上一个(prev)*文件夹,但其中有一个编号列表.如果您无法删除(folders, but a numbered list of them. If you have trouble deleting a)*差异/上一个(Diff/Prev)*由WinFiltDiff 1.0创建的文件夹,您可以将层次结构打开到十几个级别,然后向上移动最深的一个.我做了几次(然后运行似乎没有帮助的ChkDisk),然后最终可以删除所有(folder created by WinFiltDiff 1.0, you can open up the hierarchy to a dozen levels or so, then move the deepest one up. I did that a few times (and ran ChkDisk which did not seem to help) and then could finally delete all the)*上一个(Prev)*文件夹.(folders.)
已知仍然困扰1.0的错误(Bugs known to still plague 1.0)
COM生成(COM-generated).H(.h*)*有时不排除带有第一行"此ALWAYS GENERATED文件始终包含接口的定义"的文件.如果其中一个文件是由VC ++ 7.0生成的,而另一个是由VC ++ 6.0生成的,则似乎会发生这种情况.我怀疑该错误是由于一个文件中的Unicode导致的,而不是另一个文件中的.(*files bearing the first line “this ALWAYS GENERATED file contains the definitions for the interfaces” sometimes are not excluded. This seems to occur if one of the files had been generated by VC++ 7.0 and the other by VC++ 6.0. I suspect the bug is due to Unicode in one file but not the other.*)
有时,选择其他卷上的文件夹不仅可以更改您要选择它的组合框,而且(如果另一个组合框具有从列表中的第一个条目中选择的另一个条目之外),另一个组合框也可以更改.此错误已从1998 RunWinDiff GUI继承,并且其DropComboBox代码重用.(Sometimes, choosing a folder on a different volume can change not only the combo box you are selecting it into, but (if the other combo box has an entry chosen from other than the first entry on its list) also the other combo box. This bug has been inherited from the 1998 RunWinDiff GUI and its DropComboBox code reuse.)
在行尾添加其他空行(Adding additional blank lines to the end of the).文本(.txt*)*中的文件(*files in the*)*排除清单(*ExclusionLists*)*文件夹会导致所有内容都匹配(因为任何字符串都可以视为包含空行).(*folder causes everything to match (because any string can be considered to contain a null line).*)
许可
本文以及所有相关的源代码和文件均已获得The Code Project Open License (CPOL)的许可。
C++ VC6 Windows Visual-Studio Dev 新闻 翻译