From 53eb71b8d54f89ff648612a9e7e3ba5c6a9ccb73 Mon Sep 17 00:00:00 2001 From: Robin Munn Date: Wed, 29 Nov 2023 14:08:27 +0700 Subject: [PATCH 01/13] Change/delete prompt text is different in hg 6.5.1 --- src/LibChorus/Utilities/HgProcessOutputReader.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/LibChorus/Utilities/HgProcessOutputReader.cs b/src/LibChorus/Utilities/HgProcessOutputReader.cs index 4f9ce2164..2944f925f 100644 --- a/src/LibChorus/Utilities/HgProcessOutputReader.cs +++ b/src/LibChorus/Utilities/HgProcessOutputReader.cs @@ -119,14 +119,14 @@ private bool HandleChangedVsDeletedFiles(string line, StreamWriter standardInput // use (c)hanged version or leave (d)eleted? string changedVsDeletedFile = null; - var match = Regex.Match(line, @"local changed (.*) which remote deleted"); + var match = Regex.Match(line, @"file '(.*)' was deleted in other \[merge rev\] but was modified in local \[working copy\]"); if(match.Captures.Count > 0) { changedVsDeletedFile = match.Groups[1].Value; } else { - match = Regex.Match(line, @"remote changed (.*) which local deleted"); + match = Regex.Match(line, @"file '(.*)' was deleted in local \[working copy\] but was modified in other \[merge rev\]"); if(match.Captures.Count > 0) { changedVsDeletedFile = match.Groups[1].Value; From d09038933421aedc005177080589657d32586428 Mon Sep 17 00:00:00 2001 From: Robin Munn Date: Wed, 29 Nov 2023 14:08:46 +0700 Subject: [PATCH 02/13] Mercurial ignores stdin unless ui.interactive true --- src/LibChorus/VcsDrivers/Mercurial/HgRepository.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/LibChorus/VcsDrivers/Mercurial/HgRepository.cs b/src/LibChorus/VcsDrivers/Mercurial/HgRepository.cs index 5a75eada3..6e78f7e35 100644 --- a/src/LibChorus/VcsDrivers/Mercurial/HgRepository.cs +++ b/src/LibChorus/VcsDrivers/Mercurial/HgRepository.cs @@ -252,6 +252,7 @@ private void EnsureChorusMergeAddedToHgrc() var uiSection = doc.Sections.GetOrCreate("ui"); uiSection.Set("merge", mergetoolname); + uiSection.Set("interactive", "True"); var mergeToolsSection = doc.Sections.GetOrCreate("merge-tools"); // If the premerge is allowed to happen Mercurial will occasionally think it did a good enough job and not // call our mergetool. This has data corrupting results for us so we tell mercurial to skip it. From 720dd301307df129f6421ea8ce4e0d76c90f699f Mon Sep 17 00:00:00 2001 From: Robin Munn Date: Wed, 6 Dec 2023 15:52:07 +0700 Subject: [PATCH 03/13] ChorusMerge: no more need to change input encoding With the changes in Mercurial 6.5.1 and Python3, ChorusMerge now gets correctly-encoded Unicode filenames as input, without needing to go through a step where UTF-8 is double-encoded as CP1252. We also modify one unit test that relied on the old, broken behavior. --- src/ChorusMerge.Tests/ChorusMergeTests.cs | 8 +------- src/ChorusMerge/Program.cs | 18 ------------------ 2 files changed, 1 insertion(+), 25 deletions(-) diff --git a/src/ChorusMerge.Tests/ChorusMergeTests.cs b/src/ChorusMerge.Tests/ChorusMergeTests.cs index 88966317c..ec16f131b 100644 --- a/src/ChorusMerge.Tests/ChorusMergeTests.cs +++ b/src/ChorusMerge.Tests/ChorusMergeTests.cs @@ -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")) @@ -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); - 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)); } diff --git a/src/ChorusMerge/Program.cs b/src/ChorusMerge/Program.cs index d1f3d3a8e..396ec1e8d 100644 --- a/src/ChorusMerge/Program.cs +++ b/src/ChorusMerge/Program.cs @@ -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); - 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); From 93043ae3bfbcfe77c8a80414f1eb4a8dfaaded56 Mon Sep 17 00:00:00 2001 From: Robin Munn Date: Wed, 6 Dec 2023 15:55:05 +0700 Subject: [PATCH 04/13] Add hg username to four unit tests A behavior change between Mercurial 3.3 and 6.5.1 means that these four tests now fail due to Mercurial complaining that the username isn't set. Since the absence of a username has nothing to do with the matter under test, we should just change how these four tests are set up to include a username so that Mercurial is satisfied. --- src/LibChorusTests/VcsDrivers/Mercurial/HgWrappingTests.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/LibChorusTests/VcsDrivers/Mercurial/HgWrappingTests.cs b/src/LibChorusTests/VcsDrivers/Mercurial/HgWrappingTests.cs index c30a55aae..4a4ec1b1f 100644 --- a/src/LibChorusTests/VcsDrivers/Mercurial/HgWrappingTests.cs +++ b/src/LibChorusTests/VcsDrivers/Mercurial/HgWrappingTests.cs @@ -354,6 +354,7 @@ public void BackoutHead_FirstChangeSetInTheRepo_Throws() { using (var setup = new HgTestSetup()) { + setup.Repository.SetUserNameInIni("charlie brown", new NullProgress()); var path = setup.Root.GetNewTempFile(true).Path; setup.Repository.AddAndCheckinFile(path); Assert.Throws(() => @@ -366,6 +367,7 @@ public void BackoutHead_UsesCommitMessage() { using (var setup = new HgTestSetup()) { + setup.Repository.SetUserNameInIni("charlie brown", new NullProgress()); var path = setup.Root.GetNewTempFile(true).Path; setup.Repository.AddAndCheckinFile(path); File.WriteAllText(path,"2"); @@ -404,6 +406,7 @@ public void BackoutHead_CurrentlyOnAnotherBranch_LeaveUsWhereWeWere() */ using (var setup = new HgTestSetup()) { + setup.Repository.SetUserNameInIni("charlie brown", new NullProgress()); var path = setup.Root.GetNewTempFile(true).Path; File.WriteAllText(path, "original"); setup.Repository.AddAndCheckinFile(path); @@ -438,6 +441,7 @@ public void BackoutHead_BackingOutTheCurrentHead_LeaveUsOnTheNewHead() */ using (var setup = new HgTestSetup()) { + setup.Repository.SetUserNameInIni("charlie brown", new NullProgress()); var path = setup.Root.GetNewTempFile(true).Path; File.WriteAllText(path, "original"); setup.Repository.AddAndCheckinFile(path); From 91d8af06b85c7f4c7139f99e64d6f33072b635d9 Mon Sep 17 00:00:00 2001 From: Robin Munn Date: Wed, 6 Dec 2023 15:57:02 +0700 Subject: [PATCH 05/13] Update SIL.Chorus.Mercurial from 3.0.3 to 6.5.1 --- src/LibChorus/LibChorus.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/LibChorus/LibChorus.csproj b/src/LibChorus/LibChorus.csproj index 5d0770b1a..37154f6a7 100644 --- a/src/LibChorus/LibChorus.csproj +++ b/src/LibChorus/LibChorus.csproj @@ -16,7 +16,7 @@ - + From 09edf8cff546e61dac00fa307279dae4d6566b42 Mon Sep 17 00:00:00 2001 From: Robin Munn Date: Wed, 13 Dec 2023 12:36:57 +0700 Subject: [PATCH 06/13] Restore ability to generate .wxs files to build This automatically creates the GeneratedMercurial.wxs and GeneratedMercurialExtensions.wxs files used in later build steps. --- src/ChorusHub/ChorusHub.csproj | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/ChorusHub/ChorusHub.csproj b/src/ChorusHub/ChorusHub.csproj index 40e1a4342..95644a920 100644 --- a/src/ChorusHub/ChorusHub.csproj +++ b/src/ChorusHub/ChorusHub.csproj @@ -6,12 +6,15 @@ SIL.Chorus.ChorusHub WinExe true + $(MSBuildProjectDirectory)/../.. + $(teamcity_build_checkoutDir) + @@ -28,4 +31,28 @@ $(AssemblySearchPaths);{GAC} + + + + + + + + + + + \ No newline at end of file From c6d12366b2cb2dc2044cbbd9aea79bf80ba3de73 Mon Sep 17 00:00:00 2001 From: Robin Munn Date: Wed, 13 Dec 2023 14:11:05 +0700 Subject: [PATCH 07/13] Update GeneratedMercurial.wxs file This is needed for the ChorusHub installer to build. --- src/Installer/GeneratedMercurial.wxs | 563 +++++++++++++++++++++------ 1 file changed, 451 insertions(+), 112 deletions(-) diff --git a/src/Installer/GeneratedMercurial.wxs b/src/Installer/GeneratedMercurial.wxs index ac5c898ae..96f42315f 100644 --- a/src/Installer/GeneratedMercurial.wxs +++ b/src/Installer/GeneratedMercurial.wxs @@ -4,162 +4,501 @@ - + - + + + + + - + - - - + + + - - - + + + - + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - - - - - + + + + + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From 7f5068ac4b1e0e2d35e7dce2ecc33b71cb786002 Mon Sep 17 00:00:00 2001 From: Robin Munn Date: Thu, 14 Dec 2023 13:35:04 +0700 Subject: [PATCH 08/13] Update GeneratedMercurialExtensions.wxs file The location where Python stores .pyc files changed between Python 2 and Python 3, so we need to point the installer at the new location. --- .../GeneratedMercurialExtensions.wxs | 78 +++++++++++-------- 1 file changed, 45 insertions(+), 33 deletions(-) diff --git a/src/Installer/GeneratedMercurialExtensions.wxs b/src/Installer/GeneratedMercurialExtensions.wxs index 8a0695b44..29ee26ed6 100644 --- a/src/Installer/GeneratedMercurialExtensions.wxs +++ b/src/Installer/GeneratedMercurialExtensions.wxs @@ -11,34 +11,14 @@ - - - - - - - - - - - - - - - - - - - - @@ -47,30 +27,62 @@ - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + - - - - - - - + + + + + + + + + \ No newline at end of file From 2a3d10111fafa36afb7f43b5bdb8bcc2717074d4 Mon Sep 17 00:00:00 2001 From: Robin Munn Date: Thu, 14 Dec 2023 15:53:10 +0700 Subject: [PATCH 09/13] Build with specific version of Mercurial package Apparently the NuGet package being pulled in by the 6.5.1-* qualifier is too old and isn't including the recent fixes. --- src/LibChorus/LibChorus.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/LibChorus/LibChorus.csproj b/src/LibChorus/LibChorus.csproj index 37154f6a7..456c7a5fd 100644 --- a/src/LibChorus/LibChorus.csproj +++ b/src/LibChorus/LibChorus.csproj @@ -16,7 +16,7 @@ - + From 8a7add641402c2f6e0e8eaeeddd779c7be854260 Mon Sep 17 00:00:00 2001 From: Robin Munn Date: Thu, 14 Dec 2023 17:04:37 +0700 Subject: [PATCH 10/13] Use floating version for SIL.Chorus.Mercurial package Now that we know that version 6.5.1.22 is building correctly, we can set up to use that version or any later one. --- src/LibChorus/LibChorus.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/LibChorus/LibChorus.csproj b/src/LibChorus/LibChorus.csproj index 456c7a5fd..330dbd98a 100644 --- a/src/LibChorus/LibChorus.csproj +++ b/src/LibChorus/LibChorus.csproj @@ -16,7 +16,7 @@ - + From 13626ad949b885512c50d0232c88f7d968205024 Mon Sep 17 00:00:00 2001 From: Robin Munn Date: Thu, 14 Dec 2023 17:07:33 +0700 Subject: [PATCH 11/13] Update comment about encodings in ChorusMerge The ChorusMerge code no longer matches the comment; update the comment so we don't wonder in the future why the encoding games have gone away. --- src/ChorusMerge/Program.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/ChorusMerge/Program.cs b/src/ChorusMerge/Program.cs index 396ec1e8d..75e692215 100644 --- a/src/ChorusMerge/Program.cs +++ b/src/ChorusMerge/Program.cs @@ -23,10 +23,9 @@ namespace ChorusMerge /// See MergeOrder and MergeSituation for a description of those variables and their possible values. /// /// - /// The arguments are presumed to be presented in utf-8 encoding presented via CP1252. This is a departure - /// from the norm on Windows of UCS2. However, python has issues in calling out to processes using UCS2 - /// so gives utf8, which is then mangled via CP1252. This can all be decoded to give ChorusMerge the - /// ucs2 args it expects. + /// The arguments used to be presented in utf-8 encoding presented via CP1252, but Mercurial 6.5.1 and + /// Python 3 have made that unnecessary. Unicode arguments are now passed correctly without needing + /// to play games with encoding. /// public class Program { From 53264963b1ceb6fd949604940d5845df5436fa69 Mon Sep 17 00:00:00 2001 From: Robin Munn Date: Thu, 14 Dec 2023 21:50:38 +0700 Subject: [PATCH 12/13] Update CHANGELOG to mention Mercurial 6.5.1 +semver: major --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e1b705765..42521125e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,6 +26,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - Use UTF-8 in conflict details view - [SIL.Chorus.LibChorus] Add ChorusStorage (the bundle cache) as an Excluded folder - [SIL.Chorus.LibChorus] Changed HgResumeTransport LastKnownCommonBases to use Json serialization instead of BinaryFormatter +- Update SIL.Chorus.Mercurial dependency to version 6.5.1 which uses for Python 3 ### Fixed From 47c6c851fb243c517056340bc97e172ca8d9be9c Mon Sep 17 00:00:00 2001 From: Robin Munn Date: Thu, 14 Dec 2023 22:24:12 +0700 Subject: [PATCH 13/13] Update CHANGELOG.md Fix typo Co-authored-by: Eberhard Beilharz --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 42521125e..428237388 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,7 +26,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - Use UTF-8 in conflict details view - [SIL.Chorus.LibChorus] Add ChorusStorage (the bundle cache) as an Excluded folder - [SIL.Chorus.LibChorus] Changed HgResumeTransport LastKnownCommonBases to use Json serialization instead of BinaryFormatter -- Update SIL.Chorus.Mercurial dependency to version 6.5.1 which uses for Python 3 +- Update SIL.Chorus.Mercurial dependency to version 6.5.1 which uses Python 3 ### Fixed