Skip to content

Commit

Permalink
Merge pull request #904 from solidify/bugfix/ignore-empty-revisions-c…
Browse files Browse the repository at this point in the history
…ounter-fix

Count imported revisions correctly when IgnoreEmptyRevisions is true
  • Loading branch information
Alexander-Hjelm authored Nov 13, 2023
2 parents 4fa8c84 + a9cddae commit 97059c1
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions src/WorkItemMigrator/WorkItemImport/ImportCommandLine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -119,15 +119,6 @@ private bool ExecuteMigration(CommandOption token, CommandOption url, CommandOpt
continue;
}

if (config.IgnoreEmptyRevisions &&
executionItem.Revision.Fields.Count == 0 &&
executionItem.Revision.Links.Count == 0 &&
executionItem.Revision.Attachments.Count == 0)
{
Logger.Log(LogLevel.Info, $"Skipped processing empty revision: {executionItem.OriginId}, rev {executionItem.Revision.Index}");
continue;
}

WorkItem wi = null;

if (executionItem.WiId > 0)
Expand All @@ -137,9 +128,19 @@ private bool ExecuteMigration(CommandOption token, CommandOption url, CommandOpt

Logger.Log(LogLevel.Info, $"Processing {importedItems + 1}/{revisionCount} - wi '{(wi.Id > 0 ? wi.Id.ToString() : "Initial revision")}', jira '{executionItem.OriginId}, rev {executionItem.Revision.Index}'.");

agent.ImportRevision(executionItem.Revision, wi, settings);
importedItems++;

if (config.IgnoreEmptyRevisions &&
executionItem.Revision.Fields.Count == 0 &&
executionItem.Revision.Links.Count == 0 &&
executionItem.Revision.Attachments.Count == 0)
{
Logger.Log(LogLevel.Info, $"Skipped processing empty revision: {executionItem.OriginId}, rev {executionItem.Revision.Index}");
continue;
}

agent.ImportRevision(executionItem.Revision, wi, settings);

// Artifical wait (optional) to avoid throttling for ADO Services
if (config.SleepTimeBetweenRevisionImportMilliseconds > 0)
{
Expand Down

0 comments on commit 97059c1

Please sign in to comment.