Skip to content

Commit 0bf5372

Browse files
patwarepatricecalvehocMrHinsh
authored
Added .editorConfig and changed iteration node creation (#510)
* Added "paused" message when in debug * SetIterationDates called at all times, not at creation. * Tab vs space. Added .editorconfig and fixed my tabs Co-authored-by: Calvé, Patrice <[email protected]> Co-authored-by: Martin Hinshelwood nkdAgility.com <[email protected]>
1 parent 2f5234b commit 0bf5372

File tree

4 files changed

+33
-28
lines changed

4 files changed

+33
-28
lines changed

.editorconfig

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[*]
2+
end_of_line = crlf
3+
4+
[*.xml]
5+
indent_style = space
6+
7+
[*.cs]
8+
indent_style = space

VstsSyncMigrator.sln

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Console", "Console", "{FA57
4444
EndProject
4545
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{A05A7847-4C75-4E92-B156-F529483688CC}"
4646
ProjectSection(SolutionItems) = preProject
47+
.editorconfig = .editorconfig
4748
.gitattributes = .gitattributes
4849
.gitignore = .gitignore
4950
GitVersion.yml = GitVersion.yml

src/VstsSyncMigrator.Console/Program.cs

Lines changed: 12 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,19 @@
1-
using CommandLine.Text;
2-
using CommandLine;
3-
using Microsoft.ApplicationInsights;
4-
using Microsoft.ApplicationInsights.Channel;
5-
using Microsoft.ApplicationInsights.Extensibility;
6-
using Microsoft.TeamFoundation.Client;
7-
using Microsoft.TeamFoundation.WorkItemTracking.Client;
1+
using CommandLine;
2+
using Microsoft.ApplicationInsights.DataContracts;
3+
using Microsoft.VisualStudio.Services.Common;
84
using Newtonsoft.Json;
5+
using NuGet;
96
using System;
10-
using System.Collections;
117
using System.Collections.Generic;
128
using System.Diagnostics;
13-
using System.Globalization;
9+
using System.IO;
1410
using System.Linq;
15-
using System.Text;
16-
using System.Text.RegularExpressions;
17-
using System.Threading.Tasks;
11+
using System.Net;
12+
using System.Net.NetworkInformation;
13+
using VstsSyncMigrator.Commands;
1814
using VstsSyncMigrator.Engine;
19-
using VstsSyncMigrator.Engine.ComponentContext;
20-
using System.IO;
2115
using VstsSyncMigrator.Engine.Configuration;
2216
using VstsSyncMigrator.Engine.Configuration.FieldMap;
23-
using VstsSyncMigrator.Engine.Configuration.Processing;
24-
using Microsoft.ApplicationInsights.DataContracts;
25-
using NuGet;
26-
using System.Net.NetworkInformation;
27-
using VstsSyncMigrator.Commands;
28-
using Microsoft.VisualStudio.Services.Common;
29-
using System.Net;
3017

3118
namespace VstsSyncMigrator.ConsoleApp
3219
{
@@ -94,7 +81,7 @@ public static int Main(string[] args)
9481
Console.WriteLine("Writing log to " + logPath);
9582
//////////////////////////////////////////////////
9683
Version thisVersion = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
97-
84+
9885
Trace.WriteLine(string.Format("Running version detected as {0}", thisVersion), "[Info]");
9986
if (IsOnline())
10087
{
@@ -118,7 +105,7 @@ public static int Main(string[] args)
118105
#endif
119106
}
120107
}
121-
108+
122109
Trace.WriteLine(string.Format("Telemetry Enabled: {0}", Telemetry.Current.IsEnabled().ToString()), "[Info]");
123110
Trace.WriteLine("Telemetry Note: We use Application Insights to collect telemetry on performance & feature usage for the tools to help our developers target features. This data is tied to a session ID that is generated and shown in the logs. This can help with debugging.");
124111
Trace.WriteLine(string.Format("SessionID: {0}", Telemetry.Current.Context.Session.Id), "[Info]");
@@ -147,6 +134,7 @@ public static int Main(string[] args)
147134
Trace.WriteLine(string.Format("Duration: {0}", mainTimer.Elapsed.ToString("c")), "[Info]");
148135
Trace.WriteLine(string.Format("End Time: {0}", DateTime.Now.ToUniversalTime().ToLocalTime()), "[Info]");
149136
#if DEBUG
137+
Trace.WriteLine("App paused so you can check the output. Press a key to close.");
150138
Console.ReadKey();
151139
#endif
152140
return result;
@@ -233,7 +221,7 @@ private static object RunExecuteAndReturnExitCode(RunOptions opts)
233221
}
234222

235223
me.ChangeSetMapping.Add(changesetId, split[1]);
236-
}
224+
}
237225
}
238226
}
239227

src/VstsSyncMigrator.Core/Execution/MigrationContext/NodeStructuresMigrationContext.cs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using Microsoft.TeamFoundation.Server;
22
using System;
3-
using System.Collections.Generic;
43
using System.Diagnostics;
54
using System.Linq;
65
using System.Xml;
@@ -80,7 +79,7 @@ private void CreateNodes(XmlNodeList nodeList, ICommonStructureService css, Node
8079
{
8180
finishDate = DateTime.Parse(item.Attributes["FinishDate"].Value);
8281
}
83-
82+
8483
targetNode = CreateNode(css, newNodeName, parentPath, startDate, finishDate);
8584
}
8685
else
@@ -109,7 +108,7 @@ private bool ShouldCreateNode(NodeInfo parentPath, string newNodeName)
109108
var split = nodePath.Split('\\');
110109
var removeProjectAndType = split.Skip(3);
111110
var path = string.Join(@"\", removeProjectAndType);
112-
111+
113112
// We need to check if the path is a parent path of one of the base paths, as we need those
114113
foreach (var basePath in config.BasePaths)
115114
{
@@ -138,7 +137,7 @@ private NodeInfo CreateNode(ICommonStructureService css, string name, NodeInfo p
138137
{
139138
string nodePath = string.Format(@"{0}\{1}", parent.Path, name);
140139
NodeInfo node = null;
141-
140+
142141
Trace.Write(string.Format("--CreateNode: {0}", nodePath));
143142
try
144143
{
@@ -175,9 +174,18 @@ private NodeInfo CreateNode(ICommonStructureService css, string name, NodeInfo p
175174
string newPathUri = css.CreateNode(name, parent.Uri);
176175
Trace.Write("...created");
177176
node = css.GetNode(newPathUri);
177+
}
178+
179+
try
180+
{
178181
((ICommonStructureService4)css).SetIterationDates(node.Uri, startDate, finishDate);
179182
Trace.Write("...dates assigned");
180183
}
184+
catch (CommonStructureSubsystemException ex)
185+
{
186+
Telemetry.Current.TrackException(ex);
187+
Trace.Write("...dates not set");
188+
}
181189

182190
Trace.WriteLine(String.Empty);
183191
return node;

0 commit comments

Comments
 (0)