Skip to content

Commit 2f88565

Browse files
committed
PR 25: Null fields are now taken care of for Integer Tagging
- Null fields are now taken care of for Integer Tagging
1 parent bef8431 commit 2f88565

File tree

5 files changed

+31
-15
lines changed

5 files changed

+31
-15
lines changed

GitVersion.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
assembly-versioning-scheme: None
22
mode: ContinuousDeployment
3-
next-version: 0.4.2
3+
next-version: 0.4.6
44
branches: {}
55
ignore:
66
sha: []

TfsWitMigrator.Console/ApplicationInsights.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<ApplicationInsights schemaVersion="2014-05-30" xmlns="http://schemas.microsoft.com/ApplicationInsights/2013/Settings">
3-
<InstrumentationKey>6a59fbae-e6a1-4df4-9316-37b4db0fadde</InstrumentationKey>
3+
<InstrumentationKey>a7622e0a-0b81-4be1-9e85-81d500642b6f</InstrumentationKey>
44
<TelemetryChannel>
55
<DeveloperMode>true</DeveloperMode>
66
<DataUploadIntervalInSeconds>5</DataUploadIntervalInSeconds>

TfsWitMigrator.Core/FieldMaps/FieldMergeMap.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,11 @@ internal override void InternalExecute(WorkItem source, WorkItem target)
2828
{
2929
if (source.Fields.Contains(sourceField1) && source.Fields.Contains(sourceField2))
3030
{
31-
target.Fields[targetField].Value = string.Format(format, (string)source.Fields[sourceField1].Value.ToString(), (string)source.Fields[sourceField2].Value.ToString());
32-
Trace.WriteLine(string.Format(" [UPDATE] field merged {0}:{1}+{2} to {3}:{4}", source.Id, sourceField1, sourceField2, target.Id, targetField));
31+
if (source.Fields[sourceField1].Value != null)
32+
{
33+
target.Fields[targetField].Value = string.Format(format, (string)source.Fields[sourceField1].Value.ToString(), (string)source.Fields[sourceField2].Value.ToString());
34+
Trace.WriteLine(string.Format(" [UPDATE] field merged {0}:{1}+{2} to {3}:{4}", source.Id, sourceField1, sourceField2, target.Id, targetField));
35+
}
3336
}
3437
}
3538
}

TfsWitMigrator.Core/FieldMaps/FieldToTagFieldMap.cs

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,22 @@ public void Execute(WorkItem source, WorkItem target)
2424
{
2525
List<string> newTags = target.Tags.Split(char.Parse(@";")).ToList();
2626
// to tag
27-
string value = (string)source.Fields[sourceField].Value;
28-
if (string.IsNullOrEmpty(formatExpression))
27+
if (source.Fields[sourceField].Value != null)
2928
{
30-
newTags.Add(value);
31-
}
32-
else
33-
{
34-
newTags.Add(string.Format(formatExpression, value));
35-
}
29+
string value = source.Fields[sourceField].Value.ToString();
30+
if (string.IsNullOrEmpty(formatExpression))
31+
{
32+
newTags.Add(value);
33+
}
34+
else
35+
{
36+
newTags.Add(string.Format(formatExpression, value));
37+
}
3638

37-
target.Tags = string.Join(";", newTags.ToArray());
38-
Trace.WriteLine(string.Format(" [UPDATE] field tagged {0}:{1} to {2}:Tag with foramt of {3}", source.Id, sourceField, target.Id, formatExpression));
39+
target.Tags = string.Join(";", newTags.ToArray());
40+
Trace.WriteLine(string.Format(" [UPDATE] field tagged {0}:{1} to {2}:Tag with foramt of {3}", source.Id, sourceField, target.Id, formatExpression));
41+
}
42+
3943
}
4044
}
4145
}

TfsWitMigrator.Core/ProcessingContext/WorkItemUpdate.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,16 @@ internal override void InternalExecute()
5959
{
6060
if (!_whatIf)
6161
{
62-
workitem.Save();
62+
try
63+
{
64+
workitem.Save();
65+
}
66+
catch (Exception)
67+
{
68+
System.Threading.Thread.Sleep(5000);
69+
workitem.Save();
70+
}
71+
6372
} else
6473
{
6574
Trace.WriteLine("No save done: (What IF: enabled)");

0 commit comments

Comments
 (0)