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

Use chg rather than hg for Send/Receive, saving about 20 seconds per S/R #353

Merged
merged 5 commits into from
Dec 6, 2024
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
1 change: 1 addition & 0 deletions docker/scripts/create-installation-tarball.sh
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ install -d ${DBDESTDIR}/${LIB}/Mercurial/mercurial/utils
install -d ${DBDESTDIR}/${LIB}/Mercurial/mercurial/upgrade_utils
install -d ${DBDESTDIR}/${LIB}/MercurialExtensions
install -d ${DBDESTDIR}/${LIB}/MercurialExtensions/fixutf8
install -m 755 Mercurial/chg ${DBDESTDIR}/${LIB}/Mercurial
install -m 755 Mercurial/hg ${DBDESTDIR}/${LIB}/Mercurial
install -m 644 Mercurial/mercurial.ini ${DBDESTDIR}/${LIB}/Mercurial
install -m 644 Mercurial/hgdemandimport/*.* ${DBDESTDIR}/${LIB}/Mercurial/hgdemandimport
Expand Down
2 changes: 1 addition & 1 deletion lfmergeqm-background.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@

while :
do
sudo -H -u www-data lfmergeqm
sudo -H --preserve-env=CHORUS_HG_EXE -u www-data lfmergeqm
sleep 86400
done
4 changes: 2 additions & 2 deletions lfmergeqm-looping.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ trap "exit" TERM
# This is expected to run as the CMD, launched by the entry point.

while inotifywait -e close_write /var/lib/languageforge/lexicon/sendreceive/syncqueue; do
sudo -H -u www-data lfmergeqm
sudo -H --preserve-env=CHORUS_HG_EXE -u www-data lfmergeqm
# Run it again just to ensure that any initial clones that missed a race condition have a chance to get noticed
sudo -H -u www-data lfmergeqm
sudo -H --preserve-env=CHORUS_HG_EXE -u www-data lfmergeqm
done
Original file line number Diff line number Diff line change
Expand Up @@ -93,21 +93,6 @@ public void Teardown()
}
}

[Test]
public void MissingFwDataFixer_Throws()
{
// Setup
var tmpFolder = Path.Combine(_languageDepotFolder.Path, "WorkDir");
Directory.CreateDirectory(tmpFolder);
Directory.SetCurrentDirectory(tmpFolder);

// Execute/Verify
Assert.That(() => _synchronizeAction.Run(_lfProject),
// This can't happen in real life because we ensure that we have a clone
// before we call sync. Therefore it is acceptable to get an exception.
Throws.TypeOf<InvalidOperationException>());
}

[Test]
public void Error_NoHgRepo()
{
Expand Down
8 changes: 4 additions & 4 deletions src/LfMerge.Core/LfMerge.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ See full changelog at https://github.com/sillsdev/LfMerge/blob/develop/CHANGELOG
<PackageReference Include="MongoDB.Driver.Core.signed" Version="2.13.*" />
<PackageReference Include="Mono.Posix.NETStandard" Version="1.0.0" />
<PackageReference Include="SIL.Bugsnag.Signed" Version="2.2.1" />
<PackageReference Include="SIL.Chorus.Mercurial" Version="6.5.*" PrivateAssets="All" />
<PackageReference Include="SIL.Chorus.ChorusMerge" Version="6.0.0-*" GeneratePathProperty="true" />
<PackageReference Include="SIL.ChorusPlugin.LfMergeBridge" Version="4.2.0-beta*" />
<PackageReference Include="SIL.Chorus.LibChorus" Version="6.0.0-*" />
<PackageReference Include="SIL.Chorus.Mercurial" Version="6.5.1.43" PrivateAssets="All" />
<PackageReference Include="SIL.Chorus.ChorusMerge" Version="6.0.0-beta0055" GeneratePathProperty="true" />
<PackageReference Include="SIL.ChorusPlugin.LfMergeBridge" Version="4.2.0-beta0028" />
<PackageReference Include="SIL.Chorus.LibChorus" Version="6.0.0-beta0055" />
<PackageReference Include="SIL.Core.Desktop" Version="12.0.0" />
<PackageReference Include="SIL.LCModel" Version="11.0.0-beta0077" />
<PackageReference Include="SIL.LCModel.Core" Version="11.0.0-beta0077" GeneratePathProperty="true" />
Expand Down
3 changes: 3 additions & 0 deletions src/LfMerge/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ public static int Main(string[] args)
MainClass.Logger.Notice("LfMerge {2} (database {0}) starting with args: {1}",
MainClass.ModelVersion, string.Join(" ", args), MainClass.GetVersionInfo("SemVer"));

// 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
Environment.SetEnvironmentVariable("CHGHG", $"/usr/lib/lfmerge/{MainClass.ModelVersion}/Mercurial/hg");

if (string.IsNullOrEmpty(options.ProjectCode))
{
MainClass.Logger.Error("Command line doesn't contain project code - exiting.");
Expand Down
2 changes: 1 addition & 1 deletion src/LfMergeQueueManager/QueueManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public static void Main(string[] args)
if (options == null)
return;

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

// initialize the SLDR
Sldr.Initialize();
Expand Down
Loading