Skip to content

Commit 1a959e3

Browse files
authored
Use chg rather than hg for Send/Receive, saving about 20 seconds per S/R (#353)
* Bump Mercurial and Chorus packages to use chg * Preserve Chorus env vars, ensure chg can find hg * Delete no-longer-needed test This test is checking for a failure condition in LfMergeBridge that no longer happens, and is hard to get running in parallel. We might as well delete it and keep the code simple. * Use LfMergeBridge version from before breaking change to Chorus Later LfMergeBridge NuGet packages were accidentally compiled against a version of Chorus with a breaking change in the localization manager, which causes ChorusMerge failures. We'll pin LfMergeBridge to the version just before the breaking change, just in case. Once Chorus v7 has a NuGet package, we can upgrade Chorus again.
1 parent f4bdb42 commit 1a959e3

File tree

7 files changed

+12
-23
lines changed

7 files changed

+12
-23
lines changed

docker/scripts/create-installation-tarball.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ install -d ${DBDESTDIR}/${LIB}/Mercurial/mercurial/utils
7575
install -d ${DBDESTDIR}/${LIB}/Mercurial/mercurial/upgrade_utils
7676
install -d ${DBDESTDIR}/${LIB}/MercurialExtensions
7777
install -d ${DBDESTDIR}/${LIB}/MercurialExtensions/fixutf8
78+
install -m 755 Mercurial/chg ${DBDESTDIR}/${LIB}/Mercurial
7879
install -m 755 Mercurial/hg ${DBDESTDIR}/${LIB}/Mercurial
7980
install -m 644 Mercurial/mercurial.ini ${DBDESTDIR}/${LIB}/Mercurial
8081
install -m 644 Mercurial/hgdemandimport/*.* ${DBDESTDIR}/${LIB}/Mercurial/hgdemandimport

lfmergeqm-background.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@
55

66
while :
77
do
8-
sudo -H -u www-data lfmergeqm
8+
sudo -H --preserve-env=CHORUS_HG_EXE -u www-data lfmergeqm
99
sleep 86400
1010
done

lfmergeqm-looping.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ trap "exit" TERM
1010
# This is expected to run as the CMD, launched by the entry point.
1111

1212
while inotifywait -e close_write /var/lib/languageforge/lexicon/sendreceive/syncqueue; do
13-
sudo -H -u www-data lfmergeqm
13+
sudo -H --preserve-env=CHORUS_HG_EXE -u www-data lfmergeqm
1414
# Run it again just to ensure that any initial clones that missed a race condition have a chance to get noticed
15-
sudo -H -u www-data lfmergeqm
15+
sudo -H --preserve-env=CHORUS_HG_EXE -u www-data lfmergeqm
1616
done

src/LfMerge.Core.Tests/Actions/SynchronizeActionBridgeIntegrationTests.cs

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -93,21 +93,6 @@ public void Teardown()
9393
}
9494
}
9595

96-
[Test]
97-
public void MissingFwDataFixer_Throws()
98-
{
99-
// Setup
100-
var tmpFolder = Path.Combine(_languageDepotFolder.Path, "WorkDir");
101-
Directory.CreateDirectory(tmpFolder);
102-
Directory.SetCurrentDirectory(tmpFolder);
103-
104-
// Execute/Verify
105-
Assert.That(() => _synchronizeAction.Run(_lfProject),
106-
// This can't happen in real life because we ensure that we have a clone
107-
// before we call sync. Therefore it is acceptable to get an exception.
108-
Throws.TypeOf<InvalidOperationException>());
109-
}
110-
11196
[Test]
11297
public void Error_NoHgRepo()
11398
{

src/LfMerge.Core/LfMerge.Core.csproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@ See full changelog at https://github.com/sillsdev/LfMerge/blob/develop/CHANGELOG
4141
<PackageReference Include="MongoDB.Driver.Core.signed" Version="2.13.*" />
4242
<PackageReference Include="Mono.Posix.NETStandard" Version="1.0.0" />
4343
<PackageReference Include="SIL.Bugsnag.Signed" Version="2.2.1" />
44-
<PackageReference Include="SIL.Chorus.Mercurial" Version="6.5.*" PrivateAssets="All" />
45-
<PackageReference Include="SIL.Chorus.ChorusMerge" Version="6.0.0-*" GeneratePathProperty="true" />
46-
<PackageReference Include="SIL.ChorusPlugin.LfMergeBridge" Version="4.2.0-beta*" />
47-
<PackageReference Include="SIL.Chorus.LibChorus" Version="6.0.0-*" />
44+
<PackageReference Include="SIL.Chorus.Mercurial" Version="6.5.1.43" PrivateAssets="All" />
45+
<PackageReference Include="SIL.Chorus.ChorusMerge" Version="6.0.0-beta0055" GeneratePathProperty="true" />
46+
<PackageReference Include="SIL.ChorusPlugin.LfMergeBridge" Version="4.2.0-beta0028" />
47+
<PackageReference Include="SIL.Chorus.LibChorus" Version="6.0.0-beta0055" />
4848
<PackageReference Include="SIL.Core.Desktop" Version="12.0.0" />
4949
<PackageReference Include="SIL.LCModel" Version="11.0.0-beta0077" />
5050
<PackageReference Include="SIL.LCModel.Core" Version="11.0.0-beta0077" GeneratePathProperty="true" />

src/LfMerge/Program.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ public static int Main(string[] args)
4040
MainClass.Logger.Notice("LfMerge {2} (database {0}) starting with args: {1}",
4141
MainClass.ModelVersion, string.Join(" ", args), MainClass.GetVersionInfo("SemVer"));
4242

43+
// chg internal logic for finding hg trips up on LfMerge's unconvential path to hg, so we need to tell it where to find hg
44+
Environment.SetEnvironmentVariable("CHGHG", $"/usr/lib/lfmerge/{MainClass.ModelVersion}/Mercurial/hg");
45+
4346
if (string.IsNullOrEmpty(options.ProjectCode))
4447
{
4548
MainClass.Logger.Error("Command line doesn't contain project code - exiting.");

src/LfMergeQueueManager/QueueManager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public static void Main(string[] args)
2727
if (options == null)
2828
return;
2929

30-
MainClass.Logger.Notice("LfMergeQueueManager starting with args: {0}", string.Join(" ", args));
30+
MainClass.Logger.Notice("LfMergeQueueManager starting with CHORUS_HG_EXE value \"{1}\" and args: {0}", string.Join(" ", args), Environment.GetEnvironmentVariable("CHORUS_HG_EXE") ?? "<null>");
3131

3232
// initialize the SLDR
3333
Sldr.Initialize();

0 commit comments

Comments
 (0)