Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions docs/diff-tool.md
Original file line number Diff line number Diff line change
Expand Up @@ -716,11 +716,11 @@ DiffTools.UseOrder(DiffTool.P4Merge);

* Example target on left arguments for text:
```
-C utf8-bom "tempFile.txt" "targetFile.txt"
-C utf8-bom "targetFile.txt" "tempFile.txt"
```
* Example target on right arguments for text:
```
-C utf8-bom "targetFile.txt" "tempFile.txt"
-C utf8-bom "tempFile.txt" "targetFile.txt"
```
* Example target on left arguments for binary:
```
Expand All @@ -740,11 +740,11 @@ DiffTools.UseOrder(DiffTool.P4Merge);

* Example target on left arguments for text:
```
-C utf8-bom "tempFile.txt" "targetFile.txt"
-C utf8-bom "targetFile.txt" "tempFile.txt"
```
* Example target on right arguments for text:
```
-C utf8-bom "targetFile.txt" "tempFile.txt"
-C utf8-bom "tempFile.txt" "targetFile.txt"
```
* Example target on left arguments for binary:
```
Expand All @@ -762,11 +762,11 @@ DiffTools.UseOrder(DiffTool.P4Merge);

* Example target on left arguments for text:
```
-C utf8-bom "tempFile.txt" "targetFile.txt"
-C utf8-bom "targetFile.txt" "tempFile.txt"
```
* Example target on right arguments for text:
```
-C utf8-bom "targetFile.txt" "tempFile.txt"
-C utf8-bom "tempFile.txt" "targetFile.txt"
```
* Example target on left arguments for binary:
```
Expand Down
12 changes: 6 additions & 6 deletions src/DiffEngine.Tests/diffTools.include.md
Original file line number Diff line number Diff line change
Expand Up @@ -581,11 +581,11 @@ DiffTools.UseOrder(DiffTool.P4Merge);

* Example target on left arguments for text:
```
-C utf8-bom "tempFile.txt" "targetFile.txt"
-C utf8-bom "targetFile.txt" "tempFile.txt"
```
* Example target on right arguments for text:
```
-C utf8-bom "targetFile.txt" "tempFile.txt"
-C utf8-bom "tempFile.txt" "targetFile.txt"
```
* Example target on left arguments for binary:
```
Expand All @@ -605,11 +605,11 @@ DiffTools.UseOrder(DiffTool.P4Merge);

* Example target on left arguments for text:
```
-C utf8-bom "tempFile.txt" "targetFile.txt"
-C utf8-bom "targetFile.txt" "tempFile.txt"
```
* Example target on right arguments for text:
```
-C utf8-bom "targetFile.txt" "tempFile.txt"
-C utf8-bom "tempFile.txt" "targetFile.txt"
```
* Example target on left arguments for binary:
```
Expand All @@ -627,11 +627,11 @@ DiffTools.UseOrder(DiffTool.P4Merge);

* Example target on left arguments for text:
```
-C utf8-bom "tempFile.txt" "targetFile.txt"
-C utf8-bom "targetFile.txt" "tempFile.txt"
```
* Example target on right arguments for text:
```
-C utf8-bom "targetFile.txt" "tempFile.txt"
-C utf8-bom "tempFile.txt" "targetFile.txt"
```
* Example target on left arguments for binary:
```
Expand Down
7 changes: 5 additions & 2 deletions src/DiffEngine/Implementation/P4Merge.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@ static partial class Implementation
public static Definition P4Merge()
{
var launchArguments = new LaunchArguments(
// p4merge takes the two files positionally as `left right`, so the target leads for
// target-on-left and the temp file leads for target-on-right. Same order for text and
// binary; only the encoding switch differs.
Left: (temp, target) =>
{
if (FileExtensions.IsTextFile(temp))
{
return $"-C utf8-bom \"{temp}\" \"{target}\"";
return $"-C utf8-bom \"{target}\" \"{temp}\"";
}

return $"\"{target}\" \"{temp}\"";
Expand All @@ -16,7 +19,7 @@ public static Definition P4Merge()
{
if (FileExtensions.IsTextFile(temp))
{
return $"-C utf8-bom \"{target}\" \"{temp}\"";
return $"-C utf8-bom \"{temp}\" \"{target}\"";
}

return $"\"{temp}\" \"{target}\"";
Expand Down
Loading