Skip to content

Commit 3dbd4e1

Browse files
authored
Merge branch 'main' into add-project-name-validatin
2 parents 267667d + 5b9c300 commit 3dbd4e1

21 files changed

+370
-22
lines changed
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
optionsClassName: ExportWorkItemMappingToolOptions
2+
optionsClassFullName: MigrationTools.Tools.ExportWorkItemMappingToolOptions
3+
configurationSamples:
4+
- name: defaults
5+
order: 2
6+
description:
7+
code: There are no defaults! Check the sample for options!
8+
sampleFor: MigrationTools.Tools.ExportWorkItemMappingToolOptions
9+
- name: sample
10+
order: 1
11+
description:
12+
code: There is no sample, but you can check the classic below for a general feel.
13+
sampleFor: MigrationTools.Tools.ExportWorkItemMappingToolOptions
14+
- name: classic
15+
order: 3
16+
description:
17+
code: >-
18+
{
19+
"$type": "ExportWorkItemMappingToolOptions",
20+
"Enabled": false,
21+
"TargetFile": "",
22+
"PreserveExisting": true
23+
}
24+
sampleFor: MigrationTools.Tools.ExportWorkItemMappingToolOptions
25+
description: >-
26+
Tool for exporting mappings of work item IDs from source to target.
27+
Work item migration processor uses this tool to record work item ID mappings.
28+
The mappings will be saved to file defined in options at the end of the migration.
29+
className: ExportWorkItemMappingTool
30+
typeName: Tools
31+
options:
32+
- parameterName: Enabled
33+
type: Boolean
34+
description: If set to `true` then the tool will run. Set to `false` and the processor will not run.
35+
defaultValue: true
36+
isRequired: false
37+
dotNetType: System.Boolean, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e
38+
- parameterName: PreserveExisting
39+
type: Boolean
40+
description: >-
41+
Indicates whether existing mappings in the target file should be preserved when saving new mappings.
42+
Default value is `true`.
43+
defaultValue: true
44+
isRequired: false
45+
dotNetType: System.Boolean, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e
46+
- parameterName: TargetFile
47+
type: String
48+
description: Path to file, where work item mapping will be saved.
49+
defaultValue: ''
50+
isRequired: false
51+
dotNetType: System.String, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e
52+
status: missing XML code comments
53+
processingTarget: missing XML code comments
54+
classFile: src/MigrationTools/Tools/ExportWorkItemMappingTool.cs
55+
optionsClassFile: src/MigrationTools/Tools/ExportWorkItemMappingToolOptions.cs

docs/data/classes/reference.tools.tfschangesetmappingtool.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ typeName: Tools
4949
options:
5050
- parameterName: ChangeSetMappingFile
5151
type: String
52-
description: missing XML code comments
53-
defaultValue: missing XML code comments
52+
description: Path to changeset mapping file.
53+
defaultValue: null
5454
isRequired: false
5555
dotNetType: System.String, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e
5656
- parameterName: Enabled

docs/static/schema/configuration.schema.json

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1731,6 +1731,27 @@
17311731
"CommonTools": {
17321732
"type": "object",
17331733
"properties": {
1734+
"ExportWorkItemMappingTool": {
1735+
"title": "ExportWorkItemMappingTool",
1736+
"description": "Tool for exporting mappings of work item IDs from source to target.\r\n Work item migration processor uses this tool to record work item ID mappings.\r\n The mappings will be saved to file defined in options at the end of the migration.",
1737+
"type": "object",
1738+
"properties": {
1739+
"Enabled": {
1740+
"description": "If set to `true` then the tool will run. Set to `false` and the processor will not run.",
1741+
"type": "boolean",
1742+
"default": "true"
1743+
},
1744+
"PreserveExisting": {
1745+
"description": "Indicates whether existing mappings in the target file should be preserved when saving new mappings.\r\n Default value is `true`.",
1746+
"type": "boolean",
1747+
"default": "true"
1748+
},
1749+
"TargetFile": {
1750+
"description": "Path to file, where work item mapping will be saved.",
1751+
"type": "string"
1752+
}
1753+
}
1754+
},
17341755
"FieldMappingTool": {
17351756
"title": "FieldMappingTool",
17361757
"description": "Tool for applying field mapping transformations to work items during migration, supporting various field mapping strategies like direct mapping, regex transformations, and value lookups.",
@@ -2229,8 +2250,9 @@
22292250
"default": "true"
22302251
},
22312252
"ChangeSetMappingFile": {
2232-
"description": "missing XML code comments",
2233-
"type": "string"
2253+
"description": "Path to changeset mapping file.",
2254+
"type": "string",
2255+
"default": "null"
22342256
}
22352257
}
22362258
},
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"$schema": "https://json-schema.org/draft/2020-12/schema",
3+
"$id": "https://devopsmigration.io/schema/schema.tools.exportworkitemmappingtool.json",
4+
"title": "ExportWorkItemMappingTool",
5+
"description": "Tool for exporting mappings of work item IDs from source to target.\r\n Work item migration processor uses this tool to record work item ID mappings.\r\n The mappings will be saved to file defined in options at the end of the migration.",
6+
"type": "object",
7+
"properties": {
8+
"Enabled": {
9+
"description": "If set to `true` then the tool will run. Set to `false` and the processor will not run.",
10+
"type": "boolean",
11+
"default": "true"
12+
},
13+
"PreserveExisting": {
14+
"description": "Indicates whether existing mappings in the target file should be preserved when saving new mappings.\r\n Default value is `true`.",
15+
"type": "boolean",
16+
"default": "true"
17+
},
18+
"TargetFile": {
19+
"description": "Path to file, where work item mapping will be saved.",
20+
"type": "string"
21+
}
22+
}
23+
}

docs/static/schema/schema.tools.tfschangesetmappingtool.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@
66
"type": "object",
77
"properties": {
88
"ChangeSetMappingFile": {
9-
"description": "missing XML code comments",
10-
"type": "string"
9+
"description": "Path to changeset mapping file.",
10+
"type": "string",
11+
"default": "null"
1112
},
1213
"Enabled": {
1314
"description": "If set to `true` then the tool will run. Set to `false` and the processor will not run.",

src/MigrationTools.Clients.AzureDevops.Rest.Tests/Processors/AzureDevOpsProcessorTests.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ protected AzureDevOpsPipelineProcessor GetAzureDevOpsPipelineProcessor(AzureDevO
2525
services.AddSingleton<CommonTools>();
2626
services.AddSingleton<IFieldMappingTool, MockFieldMappingTool>();
2727
services.AddSingleton<IWorkItemTypeMappingTool, MockWorkItemTypeMappingTool>();
28+
services.AddSingleton<IExportWorkItemMappingTool, MockExportWorkItemMappingTool>();
2829
services.AddSingleton<IStringManipulatorTool, StringManipulatorTool>();
2930

3031
services.AddSingleton<AzureDevOpsPipelineProcessor>();

src/MigrationTools.Clients.TfsObjectModel.Tests/Processors/TfsProcessorTests.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ protected TfsTeamSettingsProcessor GetTfsTeamSettingsProcessor(TfsTeamSettingsPr
3838
services.AddSingleton<CommonTools>();
3939
services.AddSingleton<IFieldMappingTool, MockFieldMappingTool>();
4040
services.AddSingleton<IWorkItemTypeMappingTool, MockWorkItemTypeMappingTool>();
41+
services.AddSingleton<IExportWorkItemMappingTool, MockExportWorkItemMappingTool>();
4142
services.AddSingleton<IStringManipulatorTool, StringManipulatorTool>();
4243
services.AddSingleton<IWorkItemQueryBuilderFactory, WorkItemQueryBuilderFactory>();
4344
services.AddSingleton<IWorkItemQueryBuilder, WorkItemQueryBuilder>();
@@ -107,6 +108,7 @@ protected TfsSharedQueryProcessor GetTfsSharedQueryProcessor(TfsSharedQueryProce
107108
services.AddSingleton<CommonTools>();
108109
services.AddSingleton<IFieldMappingTool, MockFieldMappingTool>();
109110
services.AddSingleton<IWorkItemTypeMappingTool, MockWorkItemTypeMappingTool>();
111+
services.AddSingleton<IExportWorkItemMappingTool, MockExportWorkItemMappingTool>();
110112
services.AddSingleton<IStringManipulatorTool, StringManipulatorTool>();
111113
services.TryAddScoped<IWorkItemQueryBuilderFactory, WorkItemQueryBuilderFactory>();
112114

src/MigrationTools.Clients.TfsObjectModel.Tests/Tools/TfsRevisionManagerTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ private static List<RevisionItem> GetWorkItemWithRevisions(DateTime currentDateT
1919
for (int i = startHours; i < endHours + startHours; i++)
2020
{
2121
DateTime dateTime = dateIncreasing ? currentDateTime.AddHours(i) : currentDateTime;
22-
revisions.Add(i, new RevisionItem() { Index = i, Number = i, ChangedDate = dateTime, OriginalChangedDate = dateTime });
22+
revisions.Add(i, new RevisionItem() { Index = i, Number = i, ChangedDate = dateTime, OriginalChangedDate = dateTime, CreatedDate = dateTime, OriginalCreatedDate = dateTime });
2323
}
2424

2525
return revisions.Values.ToList();

src/MigrationTools.Clients.TfsObjectModel/Endpoints/TfsWorkItemConvertor.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ private SortedDictionary<int, RevisionItem> GetRevisionItems(RevisionCollection
4949
Number = (int)x.Fields["System.Rev"].Value,
5050
ChangedDate = (DateTime)x.Fields["System.ChangedDate"].Value,
5151
OriginalChangedDate = (DateTime)x.Fields["System.ChangedDate"].Value,
52+
CreatedDate = (DateTime)x.Fields["System.CreatedDate"].Value,
53+
OriginalCreatedDate = (DateTime)x.Fields["System.CreatedDate"].Value,
5254
Type = x.Fields["System.WorkItemType"].Value as string,
5355
Fields = GetFieldItems(x.Fields)
5456
}).ToList();

src/MigrationTools.Clients.TfsObjectModel/Processors/TfsWorkItemMigrationProcessor.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,7 @@ protected override void InternalExecute()
235235
}
236236
finally
237237
{
238+
CommonTools.ExportWorkItemMapping.SaveMappings();
238239
if (Options.FixHtmlAttachmentLinks)
239240
{
240241
CommonTools.EmbededImages?.ProcessorExecutionEnd(null);
@@ -642,6 +643,7 @@ private async Task ProcessWorkItemAsync(WorkItemData sourceWorkItem, ProgressTim
642643
}
643644
if (targetWorkItem != null)
644645
{
646+
CommonTools.ExportWorkItemMapping.AddMapping(sourceWorkItem.Id, targetWorkItem.Id);
645647
targetWorkItem.ToWorkItem().Close();
646648
}
647649
if (sourceWorkItem != null)

0 commit comments

Comments
 (0)