Skip to content

Commit 329cca5

Browse files
authored
Make Deletes respect Build and AI detection (#673)
1 parent a616d91 commit 329cca5

4 files changed

Lines changed: 29 additions & 5 deletions

File tree

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
public class DiffEngineTrayTest(ITestOutputHelper output) :
1+
#pragma warning disable CS0618 // Type or member is obsolete
2+
public class DiffEngineTrayTest(ITestOutputHelper output) :
23
XunitContextBase(output)
34
{
45
[Fact]
56
public void IsRunning() =>
67
Assert.False(DiffEngineTray.IsRunning);
7-
}
8+
}

src/DiffEngine/DiffRunner.cs

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
namespace DiffEngine;
1+
#pragma warning disable CS0618 // Type or member is obsolete
2+
namespace DiffEngine;
23

34
/// <summary>
45
/// Manages diff tools processes.
@@ -64,6 +65,7 @@ public static Task<LaunchResult> LaunchAsync(string tempFile, string targetFile,
6465
targetFile,
6566
encoding);
6667
}
68+
6769
/// <summary>
6870
/// Launch a diff tool for the given paths.
6971
/// </summary>
@@ -109,6 +111,26 @@ public static LaunchResult Launch(ResolvedTool tool, string tempFile, string tar
109111
encoding);
110112
}
111113

114+
public static void AddDelete(string file)
115+
{
116+
if (Disabled)
117+
{
118+
return;
119+
}
120+
121+
DiffEngineTray.AddDelete(file);
122+
}
123+
124+
public static Task AddDeleteAsync(string file)
125+
{
126+
if (Disabled)
127+
{
128+
return Task.CompletedTask;
129+
}
130+
131+
return DiffEngineTray.AddDeleteAsync(file);
132+
}
133+
112134
public static Task<LaunchResult> LaunchAsync(ResolvedTool tool, string tempFile, string targetFile, Encoding? encoding = null)
113135
{
114136
GuardFiles(tempFile, targetFile);

src/DiffEngine/Tray/DiffEngineTray.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
namespace DiffEngine;
22

3+
[Obsolete("Use DiffRunner")]
34
public static class DiffEngineTray
45
{
56
static DiffEngineTray()
@@ -72,4 +73,4 @@ public static Task AddMoveAsync(
7273

7374
return PiperClient.SendMoveAsync(tempFile, targetFile, exe, arguments, canKill, processId, cancel);
7475
}
75-
}
76+
}

src/Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<Project>
33
<PropertyGroup>
44
<NoWarn>CS1591;CS0649;NU1608;NU1109</NoWarn>
5-
<Version>18.1.2</Version>
5+
<Version>18.2.0</Version>
66
<AssemblyVersion>1.0.0</AssemblyVersion>
77
<PackageTags>Testing, Snapshot, Diff, Compare</PackageTags>
88
<Description>Launches diff tools based on file extensions. Designed to be consumed by snapshot testing libraries.</Description>

0 commit comments

Comments
 (0)