Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Chorus to use Mercurial 6.5.1 and Python 3 #329

Merged
merged 13 commits into from
Dec 14, 2023
Merged
27 changes: 27 additions & 0 deletions src/ChorusHub/ChorusHub.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,15 @@
<PackageId>SIL.Chorus.ChorusHub</PackageId>
<OutputType>WinExe</OutputType>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<RootDir Condition="'$(teamcity_build_checkoutDir)' == '' And '$(RootDir)'==''">$(MSBuildProjectDirectory)/../..</RootDir>
<RootDir Condition="'$(teamcity_build_checkoutDir)' != ''">$(teamcity_build_checkoutDir)</RootDir>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="GitVersion.MsBuild" Version="5.10.3" PrivateAssets="All" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" />
<PackageReference Include="SIL.ReleaseTasks" Version="2.5.0" PrivateAssets="All" />
<PackageReference Include="SIL.BuildTasks" Version="2.5.0" PrivateAssets="All" />
</ItemGroup>

<ItemGroup>
Expand All @@ -28,4 +31,28 @@
<AssemblySearchPaths>$(AssemblySearchPaths);{GAC}</AssemblySearchPaths>
</PropertyGroup>

<UsingTask TaskName="MakeWixForDirTree" AssemblyFile="$(PkgSIL_BuildTasks)\tools\SIL.BuildTasks.dll" />
<Target Name="MakeWixForDistFiles" DependsOnTargets="Compile" Condition="'$(OS)'=='Windows_NT'">
<!-- NB: The Exclude argument doesn't seem to be working so you may need to hand edit the GeneratedMercurial.wxs -->
<MakeWixForDirTree
DirectoryReferenceId="mercurial"
ComponentGroupId="Mercurial"
RootDirectory="$(RootDir)\mercurial"
OutputFilePath="$(RootDir)\src\Installer\GeneratedMercurial.wxs"
IgnoreRegExPattern="IGNOREME|\.gitignore"
Exclude="$(RootDir)\mercurial\mercurial.ini;$(RootDir)\mercurial\default.d\cacerts.rc"
MatchRegExPattern=".*">
<Output TaskParameter="OutputFilePath" ItemName="Compile" />
</MakeWixForDirTree>
<MakeWixForDirTree
DirectoryReferenceId="MercurialExtensions"
ComponentGroupId="MercurialExtensions"
RootDirectory="$(RootDir)\MercurialExtensions"
OutputFilePath="$(RootDir)\src\Installer\GeneratedMercurialExtensions.wxs"
IgnoreRegExPattern="IGNOREME|\.gitignore"
MatchRegExPattern=".*">
<Output TaskParameter="OutputFilePath" ItemName="Compile" />
</MakeWixForDirTree>
</Target>

</Project>
8 changes: 1 addition & 7 deletions src/ChorusMerge.Tests/ChorusMergeTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ private int DoMerge(GroupOfConflictingLiftFiles group)
}

[Test]
[Platform(Exclude = "Linux", Reason = "This test assumes Windows file system behavior.")]
public void Main_Utf8FilePaths_FileNamesOk()
{
using (var e = new TemporaryFolder("ChorusMergeTest"))
Expand All @@ -77,14 +76,9 @@ public void Main_Utf8FilePaths_FileNamesOk()
var filePath3 = Path.Combine(e.Path, "aaa.chorusTest");
File.WriteAllText(filePath3, @"aaa");

var encoding = Encoding.GetEncoding(1252);
rmunn marked this conversation as resolved.
Show resolved Hide resolved
string filePath1Cp1252 = encoding.GetString(Encoding.UTF8.GetBytes(filePath1));
string filePath2Cp1252 = encoding.GetString(Encoding.UTF8.GetBytes(filePath2));
string filePath3Cp1252 = encoding.GetString(Encoding.UTF8.GetBytes(filePath3));

MergeSituation.PushRevisionsToEnvironmentVariables("bob", "-123", "sally", "-456");
MergeOrder.PushToEnvironmentVariables(p.Path);
var result = Program.Main(new[] { filePath1Cp1252, filePath2Cp1252, filePath3Cp1252 });
var result = Program.Main(new[] { filePath1, filePath2, filePath3 });

Assert.That(result, Is.EqualTo(0));
}
Expand Down
18 changes: 0 additions & 18 deletions src/ChorusMerge/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,24 +40,6 @@ public static int Main(string[] args)
string commonFilePath = args[1];
string theirFilePath = args[2];

if (Platform.IsWindows)
{
if (!RuntimeInformation.FrameworkDescription.Contains("Framework"))
{
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance); // required for .NET6
}

// Convert the input arguments from cp1252 -> utf8 -> ucs2
// It always seems to be 1252, even when the input code page is actually something else. CP 2012-03
// var inputEncoding = Console.InputEncoding;
var inputEncoding = Encoding.GetEncoding(1252);
rmunn marked this conversation as resolved.
Show resolved Hide resolved
ourFilePath = Encoding.UTF8.GetString(inputEncoding.GetBytes(args[0]));
commonFilePath = Encoding.UTF8.GetString(inputEncoding.GetBytes(args[1]));
theirFilePath = Encoding.UTF8.GetString(inputEncoding.GetBytes(args[2]));
Console.WriteLine("ChorusMerge: Input encoding {0}",
inputEncoding.EncodingName);
}

//this was originally put here to test if console writes were making it out to the linux log or not
Console.WriteLine("ChorusMerge: {0}, {1}, {2}", ourFilePath, commonFilePath, theirFilePath);

Expand Down
Loading
Loading