Skip to content

Commit 909f1c9

Browse files
Improve workflow for debugging a Send/Receive
1 parent a80711d commit 909f1c9

File tree

7 files changed

+63
-27
lines changed

7 files changed

+63
-27
lines changed

src/LibFLExBridge-ChorusPlugin/Handling/ConfigLayout/DictionaryConfigurationHandlerStrategy.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// --------------------------------------------------------------------------------------------
1+
// --------------------------------------------------------------------------------------------
22
// Copyright (C) 2015-2017 SIL International. All rights reserved.
33
//
44
// Distributable under the terms of the MIT License.
@@ -15,9 +15,7 @@
1515
using Chorus.merge;
1616
using Chorus.merge.xml.generic;
1717
using Chorus.VcsDrivers.Mercurial;
18-
using LibFLExBridgeChorusPlugin.Handling;
1918
using LibFLExBridgeChorusPlugin.Infrastructure;
20-
using LibTriboroughBridgeChorusPlugin;
2119
using SIL.IO;
2220

2321
namespace LibFLExBridgeChorusPlugin.Handling.ConfigLayout

src/LibFLExBridge-ChorusPlugin/Infrastructure/FlexBridgeSynchronizerAdjunct.cs

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -101,27 +101,27 @@ private bool RunFixFwData(IProgress progress)
101101
{
102102
using (var process = new Process())
103103
{
104-
var startInfo = process.StartInfo;
105-
startInfo.FileName = _fixitPathname.Replace("\"", null);
106-
startInfo.Arguments = "\"" + _fwdataPathname.Replace("\"", null) + "\"";
107-
startInfo.CreateNoWindow = false;
108-
startInfo.UseShellExecute = false;
109-
startInfo.WorkingDirectory = Path.GetDirectoryName(_fixitPathname) ?? string.Empty;
110-
startInfo.RedirectStandardOutput = true;
111-
process.Start();
112-
var mergeOutput = process.StandardOutput.ReadToEnd();
113-
process.WaitForExit();
114-
// If the user requests verbose output they can see all the fixup reports.
115-
// Unfortunately this includes sequences of dots intended to show progress on the console.
116-
// They always occur at the start of a line. The Replace gets rid of them.
117-
progress.WriteVerbose(new Regex(@"(?<=(^|\n|\r))\.+").Replace(mergeOutput, ""));
118-
// 0 means fixup ran but fixed nothing, 1 means it ran and fixed something, anything else is a problem
119-
if(process.ExitCode != 0 && process.ExitCode != 1)
120-
{
121-
throw new Exception("Merge fixing program has crashed.");
104+
var startInfo = process.StartInfo;
105+
startInfo.FileName = _fixitPathname.Replace("\"", null);
106+
startInfo.Arguments = "\"" + _fwdataPathname.Replace("\"", null) + "\"";
107+
startInfo.CreateNoWindow = false;
108+
startInfo.UseShellExecute = false;
109+
startInfo.WorkingDirectory = Path.GetDirectoryName(_fixitPathname) ?? string.Empty;
110+
startInfo.RedirectStandardOutput = true;
111+
process.Start();
112+
var mergeOutput = process.StandardOutput.ReadToEnd();
113+
process.WaitForExit();
114+
// If the user requests verbose output they can see all the fixup reports.
115+
// Unfortunately this includes sequences of dots intended to show progress on the console.
116+
// They always occur at the start of a line. The Replace gets rid of them.
117+
progress.WriteVerbose(new Regex(@"(?<=(^|\n|\r))\.+").Replace(mergeOutput, ""));
118+
// 0 means fixup ran but fixed nothing, 1 means it ran and fixed something, anything else is a problem
119+
if(process.ExitCode != 0 && process.ExitCode != 1)
120+
{
121+
throw new Exception("Merge fixing program has crashed.");
122+
}
123+
return process.ExitCode == 1;
122124
}
123-
return process.ExitCode == 1;
124-
}
125125
}
126126

127127
/// <summary>

src/RepositoryUtility/Program.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@
22
// This software is licensed under the MIT License (http://opensource.org/licenses/MIT)
33

44
using System;
5+
using System.Collections.Generic;
56
using System.ComponentModel.Composition.Hosting;
67
using System.IO;
78
using System.Reflection;
89
using System.Windows.Forms;
910
using Chorus.VcsDrivers.Mercurial;
1011
using Gecko;
12+
using L10NSharp;
1113
using RepositoryUtility.Properties;
1214
using SIL.IO;
1315
using SIL.PlatformUtilities;
@@ -39,7 +41,10 @@ static void Main()
3941

4042
Application.EnableVisualStyles();
4143
Application.SetCompatibleTextRenderingDefault(false);
42-
44+
TriboroughBridgeUtilities.SetupLocalization(new Dictionary<string, string>
45+
{
46+
{ CommandLineProcessor.locale, "en" }
47+
});
4348
using (var hotspot = new HotSpotProvider())
4449
{
4550
// This is a kludge to make sure we have a real reference to PalasoUIWindowsForms.

src/RepositoryUtility/Properties/Settings.Designer.cs

Lines changed: 13 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/RepositoryUtility/Properties/Settings.settings

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,8 @@
1414
<Setting Name="CallUpgrade" Provider="RepositoryUtility.Properties.SettingsProvider" Type="System.Boolean" Scope="User">
1515
<Value Profile="(Default)">True</Value>
1616
</Setting>
17+
<Setting Name="OpenLocalStartFolder" Type="System.String" Scope="User">
18+
<Value Profile="(Default)" />
19+
</Setting>
1720
</Settings>
1821
</SettingsFile>

src/RepositoryUtility/RepositoryUtilityForm.cs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
using LibFLExBridgeChorusPlugin.DomainServices;
2323
using LibTriboroughBridgeChorusPlugin;
2424
using LibTriboroughBridgeChorusPlugin.Infrastructure.ActionHandlers;
25+
using RepositoryUtility.Properties;
2526
using SIL.PlatformUtilities;
2627
using SIL.Progress;
2728

@@ -123,14 +124,17 @@ private void HandleOpenLocalRepositoryClick(object sender, EventArgs e)
123124
// Get some selected folder that hopefully has a repo in it.
124125
using (var folderDlg = new FolderBrowserDialog())
125126
{
127+
var openLocalStartLoc = Settings.Default.OpenLocalStartFolder;
126128
folderDlg.ShowNewFolderButton = false;
127-
folderDlg.SelectedPath = _repoHoldingFolder;
129+
folderDlg.SelectedPath = string.IsNullOrEmpty(openLocalStartLoc) ? _repoHoldingFolder : openLocalStartLoc;
128130
if (folderDlg.ShowDialog(this) != DialogResult.OK)
129131
{
130132
_repoFolder = null;
131133
return;
132134
}
133135
_repoFolder = folderDlg.SelectedPath;
136+
Settings.Default.OpenLocalStartFolder = _repoFolder;
137+
Settings.Default.Save();
134138
}
135139

136140
if (!HasRepo)
@@ -256,6 +260,17 @@ private void HandleSendBackToSourceMenuClick(object sender, EventArgs e)
256260
: Path.Combine(_repoFolder, Path.GetFileName(_repoFolder) + LibTriboroughBridgeSharedConstants.FwXmlExtension),
257261
repoType);
258262
syncDlg.SetSynchronizerAdjunct(syncAdjunt);
263+
var versionString = LibFLExBridgeUtilities.GetFlexModelVersion(_repoFolder);
264+
var versionNumbers = versionString.Split(new[] { "{", ":", "}" },
265+
StringSplitOptions.RemoveEmptyEntries);
266+
if (versionNumbers.Length == 0)
267+
throw new Exception("Invalid version number in branch name");
268+
var version = Int32.Parse(versionNumbers.Length > 1 ? versionNumbers[1] : versionNumbers[0]);
269+
270+
MetadataCache.MdCache.UpgradeToVersion(version);
271+
// Use Lexicon location to build up custom properties in support of validating a commit outside of a merge context
272+
var mergeOrderFolder = Path.Combine(_repoFolder, FlexBridgeConstants.Lexicon);
273+
MetadataCache.MdCache.AddCustomPropInfo(new MergeOrder(mergeOrderFolder, mergeOrderFolder, mergeOrderFolder, new NullMergeSituation()));
259274

260275
// Chorus does it in this order:
261276
// Local Commit

src/RepositoryUtility/app.config

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?xml version="1.0" encoding="utf-8" ?>
1+
<?xml version="1.0" encoding="utf-8" ?>
22
<configuration>
33
<configSections>
44
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
@@ -13,6 +13,9 @@
1313
<setting name="CallUpgrade" serializeAs="String">
1414
<value>True</value>
1515
</setting>
16+
<setting name="OpenLocalStartFolder" serializeAs="String">
17+
<value />
18+
</setting>
1619
</RepositoryUtility.Properties.Settings>
1720
</userSettings>
1821
</configuration>

0 commit comments

Comments
 (0)