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

ignore-empty-revisions flag #876

Merged
merged 2 commits into from
Oct 9, 2023
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 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
Loading