Skip to content

Commit

Permalink
Node creation on demand!
Browse files Browse the repository at this point in the history
  • Loading branch information
MrHinsh committed Nov 15, 2023
1 parent 97de284 commit e06884b
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 15 deletions.
18 changes: 9 additions & 9 deletions docs/Reference/Generated/MigrationTools.Host.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,15 @@ private NodeInfo GetOrCreateNode(string nodePath, DateTime? startDate, DateTime?
_pathToKnownNodeMap.TryGetValue(currentAncestorPath, out parentNode);
if (parentNode == null)
{
parentNode= _targetCommonStructureService.GetNodeFromPath(currentAncestorPath);
try
{
parentNode = _targetCommonStructureService.GetNodeFromPath(currentAncestorPath);
} catch (Exception ex)
{
Log.LogDebug(" Not Found:", currentAncestorPath);
parentNode = null;
}

}
}
else
Expand Down Expand Up @@ -251,7 +259,7 @@ public override void ProcessorExecutionBegin(IProcessor processor)
{
Log.LogInformation("Migrating all Nodes before the Processor run.");
EntryForProcessorType(processor);
MigrateAllNodeStructures();
//MigrateAllNodeStructures();
RefreshForProcessorType(processor);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/MigrationTools.Host/MigrationToolHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ public static IHostBuilder CreateDefaultBuilder(string[] args)
private static string GetVersionTextForLog()
{
Version runningVersion = DetectVersionService2.GetRunningVersion();
string textVersion = ((runningVersion.Major > 1) ? "$v" + runningVersion : ThisAssembly.Git.BaseTag + "-" + ThisAssembly.Git.Commits + "-local");
string textVersion = ((runningVersion.Major > 1) ? "v" + runningVersion : ThisAssembly.Git.BaseTag + "-" + ThisAssembly.Git.Commits + "-local");
return textVersion;
}

Expand Down
12 changes: 9 additions & 3 deletions src/MigrationTools.Host/StartupService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,9 @@ public void RunStartupLogic(string[] args)
Log.Warning("Windows Server: If you are running on Windows Server you can use the experimental version of Winget, or you can still use Chocolatey to manage the install. Install chocolatey from https://chocolatey.org/install and then use `choco install vsts-sync-migrator` to install, and `choco upgrade vsts-sync-migrator` to upgrade to newer versions.", _detectVersionService.PackageId);
} else
{
if (!_detectVersionService.IsPackageInstalled && !_detectVersionService.IsRunningInDebug)
if (!_detectVersionService.IsRunningInDebug)
{
if (!_detectVersionService.IsPackageInstalled)
{
Log.Information("It looks like this application has been installed from a zip, would you like to use the managed version?");
Console.WriteLine("Do you want install the managed version? (y/n)");
Expand All @@ -85,14 +87,14 @@ public void RunStartupLogic(string[] args)
}
if (_detectVersionService.IsUpdateAvailable && _detectVersionService.IsPackageInstalled)
{
Log.Information("It looks like this application has been installed from a zip, would you like to use the managed version from Winget?");
Log.Information("It looks like an updated version is available from Winget, would you like to update?");
Console.WriteLine("Do you want install the managed version? (y/n)");
if (Console.ReadKey().Key == ConsoleKey.Y)
{
_detectVersionService.UpdateFromSource();
}
}
if ((_detectVersionService.IsNewLocalVersionAvailable && _detectVersionService.IsPackageInstalled) && !_detectVersionService.IsRunningInDebug)
if (_detectVersionService.IsNewLocalVersionAvailable && _detectVersionService.IsPackageInstalled)
{
Log.Information("It looks like this package ({PackageId}) has been updated locally to version {InstalledVersion} and you are not running the latest version?", _detectVersionService.PackageId, _detectVersionService.InstalledVersion);
Console.WriteLine("Do you want to quit and restart? (y/n)");
Expand All @@ -104,6 +106,10 @@ public void RunStartupLogic(string[] args)
Environment.Exit(0);
}
}
} else
{
Log.Information("Running in Debug! No further version checkes.....");
}
}
} else
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ protected override void InternalExecute()
embededImagesEnricher = Services.GetRequiredService<TfsEmbededImagesEnricher>();
gitRepositoryEnricher = Services.GetRequiredService<TfsGitRepositoryEnricher>();


_nodeStructureEnricher.ProcessorExecutionBegin(null);

var stopwatch = Stopwatch.StartNew();
Expand Down

0 comments on commit e06884b

Please sign in to comment.