Skip to content

Commit f4448ca

Browse files
committed
Add MigrateRootNodes option with 'false' default to preserver backward compatibility
1 parent 2151432 commit f4448ca

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

src/MigrationTools.Clients.TfsObjectModel/Tools/TfsNodeStructureTool.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -466,8 +466,11 @@ private void ProcessCommonStructure(string treeTypeSource, string localizedTreeT
466466

467467
_pathToKnownNodeMap[structureParent.Path] = structureParent;
468468

469-
XmlElement mainNode = sourceTree.ChildNodes.OfType<XmlElement>().First();
470-
CreateNewRootNode(mainNode, nodeStructureType);
469+
if (Options.MigrateRootNodes)
470+
{
471+
XmlElement mainNode = sourceTree.ChildNodes.OfType<XmlElement>().First();
472+
CreateNewRootNode(mainNode, nodeStructureType);
473+
}
471474
if (sourceTree.ChildNodes[0].HasChildNodes)
472475
{
473476
// The XPath would look like this: /Nodes/Node[Name=Area]/Children/...

src/MigrationTools.Clients.TfsObjectModel/Tools/TfsNodeStructureToolOptions.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,15 @@ public sealed class TfsNodeStructureToolOptions : ToolOptions, ITfsNodeStructure
3030
/// </summary>
3131
public bool ShouldCreateMissingRevisionPaths { get; set; }
3232
public bool ReplicateAllExistingNodes { get; set; }
33+
34+
/// <summary>
35+
/// By default, only child nodes in node structures are migrated. Turning this on migrates even the root node
36+
/// (default area/iteration). This is useful, when you do not have any child areas ion source, but want to migrate
37+
/// default area in source to some sub-area in target project. You have to set proper mapping for this to work.
38+
/// If after mapping the target node is still just root node (so it is not migrated under some child node),
39+
/// nothing happens – so migrating root nodes works only if the are remapped to some child node in target project.
40+
/// </summary>
41+
public bool MigrateRootNodes { get; set; } = false;
3342
}
3443

3544
public class NodeOptions

0 commit comments

Comments
 (0)