====== WinMerge ====== WinMerge は、オープンソースの Windows 用比較・マージツールです。WinMerge は、フォルダとファイル両方が比較でき、理解しやすく扱いやすいテキスト形式で差異をビジュアルに表現します。 ===== Tips ===== ==== 空白とタブを無視する ==== メニューの編集の設定にて、下図の赤枠の設定にする。\\ 空白を「すべて無視する」にすると、タブとスペースが同一視される。\\ {{:it技術:winmerge設定.png}} ==== バイナリファイルを比較対象から除外 ==== Javaなどバイナリファイル(classやjar)などを比較対象から除外したい場合、フィルターを作成する。 [[http://seesaawiki.jp/aki/d/WinMerge%20%A4%CE%A5%D5%A5%A1%A5%A4%A5%EB%A5%D5%A5%A3%A5%EB%A5%BF|WinMerge のファイルフィルタ]] f: はファイルのパターンを正規表現で指定する。\\ d: はディレクトリのパターンを正規表現で指定する。 def: のところで選択するinclude と exclude の意味が、普通の感覚と逆になっている。\\ def: include と指定すると、設定ファイルで指定されたパターンのファイルが比較対象とならない。\\ def: exclude と指定すると、設定ファイルで指定されたパターンのファイルだけが比較対象となる。 ## This is a directory/file filter for WinMerge ## This filter suppresses various binaries found in ADAMulti source trees name: Java desc: Suppresses various binaries found in Java source trees ## This is an inclusive (loose) filter ## (it lets through everything not specified) def: include ## Filters for filenames begin with f: ## Filters for directories begin with d: ## (Inline comments begin with " ##" and extend to the end of the line) f: \.class$ ## class file f: \.jar$ ## jar file d: \\classes$ ## class files d: \\log$ ## log files ==== ログファイルを比較対象から除外 ==== ファイルまたはフォルダ選択画面時の下側にある「フォルダー:フィルター」に「log.flt」を指定する。 ## This is a directory/file filter template for WinMerge name: Log desc: Longer description ## Select if filter is inclusive or exclusive ## Inclusive (loose) filter lets through all items not matching rules ## Exclusive filter lets through only items that match to rule ## include or exclude def: include ## Filters for filenames begin with f: ## Filters for directories begin with d: ## (Inline comments begin with " ##" and extend to the end of the line) f: \.log$ ## Filter for filename d: \\log$ ## Filter for directory ==== 行フィルタで比較対象から除外 ==== ツール->フィルタ->行フィルタに正規表現を追加して、行フィルタを有効にすると対象行が違っていても比較対象から除外してくれる。 [[https://necoyama3.hatenablog.com/entry/20090227/1235754021|WinMergeでバージョン管理されたファイルのCVSやSVNのキーワードを除外して比較する]] ==== 先頭日時を除外して比較する ==== [[https://qiita.com/zaki-lknr/items/e46a0395fac05799847c|WinMergeの比較処理前に正規表現フィルタのプラグインで差分を無視したいテキストを定義する]] PrediffLineFilterフィルタの設定にて、正規表現を使用して先頭日時を除外して比較する。\\ 似た機能に行フィルタがあるが、それだと行全体が除外されてしまう。 ^設定^入力^ ^大文字小文字の違い| | ^正規表現を使用|✓| ^検索文字列|%%^%%\d{2}/\d{2}/\d{4} \d{2}:\d{2}:\d{2}.\d{3}| ^置換後の文字列| | メイン画面の[プラグイン]->[比較前処理プラグイン]->[PrediffLineFilter.sct]にチェックが入った状態にします。 ==== 「選択されたファイルは同一です」で何も表示されない ==== 「選択されたファイルは同一です」で何も表示されない場合、Diffコンテキストが「0:で差分のみ」になっている。同じでも全行表示したい場合、Diffコンテキストで「全行」にする。 メニューの [表示(V)] → [Diffコンテキスト(D)] から希望の設定を選択する。\\ https://hirooooo-lab.com/development/winmerge/ * 全行 * 0:で差分のみ * 1:で差分行の前後1行を含めて表示 * 2:で差分行の前後2行を含めて表示 * n:で同様に前後n行を含めて表示