Skip to content

Commit ada7c05

Browse files
committed
PR 62: Merge pbi/4893-supportStructureMigrator to master +semver:minor
- Updated NodeStructuresMigration.cs to support choosing the scructure - Added support for Stuctures with #4893 - Merge branch 'master' Related work items: #4893
1 parent 3a104a3 commit ada7c05

File tree

3 files changed

+22
-19
lines changed

3 files changed

+22
-19
lines changed

TfsWitMigrator.Core/Configuration/Processing/NodeStructuresMigrationConfig.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ namespace VSTS.DataBulkEditor.Engine.Configuration.Processing
99
public class NodeStructuresMigrationConfig : ITfsProcessingConfig
1010
{
1111
public bool Enabled { get; set; }
12+
public bool PrefixProjectToNodes { get; set; }
1213

1314
public Type Processor
1415
{

TfsWitMigrator.Core/Execution/MigrationContext/NodeStructuresMigrationContext.cs

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ namespace VSTS.DataBulkEditor.Engine
1010
{
1111
public class NodeStructuresMigrationContext : MigrationContextBase
1212
{
13+
NodeStructuresMigrationConfig config;
1314

1415
public override string Name
1516
{
@@ -21,6 +22,7 @@ public override string Name
2122

2223
public NodeStructuresMigrationContext(MigrationEngine me, NodeStructuresMigrationConfig config) : base(me, config)
2324
{
25+
this.config = config;
2426
}
2527

2628
internal override void InternalExecute()
@@ -29,28 +31,28 @@ internal override void InternalExecute()
2931
ICommonStructureService sourceCss = (ICommonStructureService)me.Source.Collection.GetService(typeof(ICommonStructureService));
3032
ProjectInfo sourceProjectInfo = sourceCss.GetProjectFromName(me.Source.Name);
3133
NodeInfo[] sourceNodes = sourceCss.ListStructures(sourceProjectInfo.Uri);
32-
33-
NodeInfo sourceAreaNode = (from n in sourceNodes where n.Path.Contains("Area") select n).Single();
34-
35-
XmlElement sourceAreaTree = sourceCss.GetNodesXml(new string[] { sourceAreaNode.Uri }, true);
36-
37-
NodeInfo sourceIterationNode = (from n in sourceNodes where n.Path.Contains("Iteration") select n).Single();
38-
XmlElement sourceIterationsTree = sourceCss.GetNodesXml(new string[] { sourceIterationNode.Uri }, true);
3934
//////////////////////////////////////////////////
4035
ICommonStructureService targetCss = (ICommonStructureService)me.Target.Collection.GetService(typeof(ICommonStructureService));
4136
//////////////////////////////////////////////////
37+
ProcessCommonStructure("Area", sourceNodes, targetCss, sourceCss);
38+
//////////////////////////////////////////////////
39+
ProcessCommonStructure("Iteration", sourceNodes, targetCss, sourceCss);
40+
//////////////////////////////////////////////////
41+
}
4242

43-
NodeInfo areaParent = CreateNode(targetCss, me.Source.Name, targetCss.GetNodeFromPath(string.Format("\\{0}\\Area", me.Target.Name)));
44-
if (sourceAreaTree.ChildNodes[0].HasChildNodes)
45-
{
46-
CreateNodes(sourceAreaTree.ChildNodes[0].ChildNodes[0].ChildNodes, targetCss, areaParent);
43+
private void ProcessCommonStructure(string treeType, NodeInfo[] sourceNodes, ICommonStructureService targetCss, ICommonStructureService sourceCss)
44+
{
45+
NodeInfo sourceNode = (from n in sourceNodes where n.Path.Contains(treeType) select n).Single();
46+
XmlElement sourceTree = sourceCss.GetNodesXml(new string[] { sourceNode.Uri }, true);
47+
NodeInfo structureParent = targetCss.GetNodeFromPath(string.Format("\\{0}\\{1}", me.Target.Name, treeType));
48+
if (config.PrefixProjectToNodes)
49+
{
50+
structureParent = CreateNode(targetCss, me.Source.Name, structureParent);
4751
}
48-
NodeInfo iterationParent = CreateNode(targetCss, me.Source.Name, targetCss.GetNodeFromPath(string.Format("\\{0}\\Iteration", me.Target.Name)));
49-
if (sourceIterationsTree.ChildNodes[0].HasChildNodes)
52+
if (sourceTree.ChildNodes[0].HasChildNodes)
5053
{
51-
CreateNodes(sourceIterationsTree.ChildNodes[0].ChildNodes[0].ChildNodes, targetCss, iterationParent);
54+
CreateNodes(sourceTree.ChildNodes[0].ChildNodes[0].ChildNodes, targetCss, structureParent);
5255
}
53-
//////////////////////////////////////////////////
5456
}
5557

5658
private void CreateNodes(XmlNodeList nodeList, ICommonStructureService css, NodeInfo parentPath)

TfsWitMigrator.Core/_VSTS.DataBulkEditor.Engine.nuspec

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66
<title>$title$</title>
77
<authors>nkdAgility, MrHinsh</authors>
88
<owners>nkdAgility, MrHinsh</owners>
9-
<licenseUrl>https://github.com/nkdAgility/vsts-data-bulk-editor</licenseUrl>
10-
<projectUrl>https://github.com/nkdAgility/vsts-data-bulk-editor</projectUrl>
9+
<licenseUrl>https://github.com/nkdAgility/vsts-sync-migration</licenseUrl>
10+
<projectUrl>https://github.com/nkdAgility/vsts-sync-migration</projectUrl>
1111
<iconUrl>http://nkdagility.com/wp-content/uploads/2014/03/cropped-nakedalm-logo-260.png</iconUrl>
1212
<requireLicenseAcceptance>false</requireLicenseAcceptance>
13-
<description>naked Agility Visual Studio Team Services Bulk Data Editor Engine allows you to bulk edit data in Microsoft Team Foundation Server (TFS) and Visual Studio Team Services (VSTS). You can migrate work items, area &amp; iterations, &amp; test data from one Team Project to another. You can builk update work items and apply processing rules against your server or account. While the code is managed on Visual Studio Team Services all commits and releases are synched to https://github.com/nkdAgility/vsts-data-bulk-editor/ </description>
14-
<releaseNotes>Summary of changes made in this release of the package.</releaseNotes>
13+
<description>naked Agility Visual Studio Team Services Sync &amp; Migration Engine allows you to bulk edit data in Microsoft Team Foundation Server (TFS) and Visual Studio Team Services (VSTS). You can migrate work items, area &amp; iterations, &amp; test data from one Team Project to another. You can builk update work items and apply processing rules against your server or account. While the code is managed on Visual Studio Team Services all commits and releases are synched to https://github.com/nkdAgility/vsts-data-bulk-editor/ </description>
14+
<releaseNotes>If you are looking for the migration tool, not just the API then use https://github.com/nkdAgility/vsts-sync-migration/releases. </releaseNotes>
1515
<copyright>Copyright © naked Agility Limited 2016</copyright>
1616
<tags>VS-TeamServices, VSTS, Visual Studio, TFS, Team Foundation Server</tags>
1717
</metadata>

0 commit comments

Comments
 (0)