Skip to content

Commit

Permalink
Merge pull request #876 from solidify/feature/ignore-empty-reivisons
Browse files Browse the repository at this point in the history
ignore-empty-revisions flag
  • Loading branch information
Alexander-Hjelm authored Oct 9, 2023
2 parents 2d334fb + 60c61b7 commit 349ce1d
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/Samples/config-agile.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"ignore-failed-links": true,
"include-link-comments": false,
"include-jira-css-styles": false,
"ignore-empty-revisions": false,
"sleep-time-between-revision-import-milliseconds": 0,
"process-template": "Agile",
"link-map": {
Expand Down
1 change: 1 addition & 0 deletions docs/Samples/config-basic.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"ignore-failed-links": true,
"include-link-comments": false,
"include-jira-css-styles": false,
"ignore-empty-revisions": false,
"sleep-time-between-revision-import-milliseconds": 0,
"process-template": "Basic",
"link-map": {
Expand Down
1 change: 1 addition & 0 deletions docs/Samples/config-cmmi.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"ignore-failed-links": true,
"include-link-comments": false,
"include-jira-css-styles": false,
"ignore-empty-revisions": false,
"sleep-time-between-revision-import-milliseconds": 0,
"process-template": "CMMI",
"link-map": {
Expand Down
1 change: 1 addition & 0 deletions docs/Samples/config-scrum.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"ignore-failed-links": true,
"include-link-comments": false,
"include-jira-css-styles": false,
"ignore-empty-revisions": false,
"sleep-time-between-revision-import-milliseconds": 0,
"process-template": "Scrum",
"link-map": {
Expand Down
1 change: 1 addition & 0 deletions docs/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ The migration configuration file is defined in a json file with the properties d
|**ignore-failed-links**|False|boolean|Set to True if failed links are to be ignored. Default = False.|
|**include-link-comments**|False|boolean|Set to True to get a verbose comment on the work item for every work item link created. Default = True.|
|**include-jira-css-styles**|True|boolean|Set to True to generate and include confluence CSS Stylesheets for description, repro steps and comments. Default = True.|
|**ignore-empty-revisions**|False|boolean|Set to True to ignore importing empty revisions. Empty revisions will be created if you have historical revisions where none of the changed fields or links have been mapped. This may indicate that you have unmapped data, which will not be migrated. Default = False.|
|**sleep-time-between-revision-import-milliseconds**|False|integer|How many milliseconds to sleep between each revision import. Use this if throttling is an issue for ADO Services. Default = 0 (no sleep).|
|**process-template**|False|string|Process template in the target DevOps project. Supported values: Scrum, Agile or CMMI. Default = "Scrum".|
|**link-map**|True|json|List of **links** to map between Jira and Azure DevOps/TFS work item link types.|
Expand Down
4 changes: 4 additions & 0 deletions src/WorkItemMigrator/Migration.Common/Config/ConfigJson.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,11 @@ public class ConfigJson

[JsonProperty(PropertyName = "include-commits")]
public bool IncludeCommits { get; set; } = false;

[JsonProperty(PropertyName = "include-jira-css-styles")]
public bool IncludeJiraCssStyles { get; set; } = true;

[JsonProperty(PropertyName = "ignore-empty-revisions")]
public bool IgnoreEmptyRevisions { get; set; } = false;
}
}
11 changes: 11 additions & 0 deletions src/WorkItemMigrator/WorkItemImport/ImportCommandLine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,18 @@ private void ExecuteMigration(CommandOption token, CommandOption url, CommandOpt
try
{
if (!forceFresh && context.Journal.IsItemMigrated(executionItem.OriginId, executionItem.Revision.Index))
{
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;

Expand Down

0 comments on commit 349ce1d

Please sign in to comment.