Skip to content

Commit

Permalink
Add WinMerge to known diff tools (#510)
Browse files Browse the repository at this point in the history
/u keeps WinMerge from adding the files to the MRU list
/wl makes the left file (received) read-only

src/Shouldly.Tests/ConventionTests/ApprovePublicAPI.ShouldlyApi.approved.cs
  • Loading branch information
bdukes authored and josephwoodward committed Jul 25, 2018
1 parent ea5739a commit 6c25e66
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
Expand Up @@ -684,6 +684,7 @@ public class KnownDiffTools
public readonly Shouldly.Configuration.DiffTool KDiff3;
public readonly Shouldly.Configuration.DiffTool P4Merge;
public readonly Shouldly.Configuration.DiffTool TortoiseGitMerge;
public readonly Shouldly.Configuration.DiffTool WinMerge;
public KnownDiffTools() { }
public static Shouldly.Configuration.KnownDiffTools Instance { get; }
}
Expand Down
10 changes: 10 additions & 0 deletions src/Shouldly/Configuration/KnownDiffTools.cs
Expand Up @@ -19,6 +19,8 @@ public class KnownDiffTools
[UsedImplicitly]
public readonly DiffTool TortoiseGitMerge = new DiffTool("Tortoise Git Merge", @"TortoiseGit\bin\TortoiseGitMerge.exe", TortoiseGitMergeArgs);
[UsedImplicitly]
public readonly DiffTool WinMerge = new DiffTool("WinMerge", @"WinMerge\WinMergeU.exe", WinMergeArgs);
[UsedImplicitly]
public readonly DiffTool CurrentVisualStudio = new CurrentlyRunningVisualStudioDiffTool();

public static KnownDiffTools Instance { get; } = new KnownDiffTools();
Expand Down Expand Up @@ -57,6 +59,14 @@ static string TortoiseGitMergeArgs(string received, string approved, bool approv

return $"\"{received}\" \"{approved}\"";
}

static string WinMergeArgs(string received, string approved, bool approvedExists)
{
if (!approvedExists)
File.AppendAllText(approved, string.Empty);

return $"/u /wl \"{received}\" \"{approved}\" \"{approved}\"";
}
}
}
#endif

0 comments on commit 6c25e66

Please sign in to comment.