Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Defer link import if the revision has any fields #1086

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions src/WorkItemMigrator/WorkItemImport/Agent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -656,6 +656,14 @@ private bool ApplyAndSaveLinks(WiRevision rev, WorkItem wi, Settings settings)
{
bool success = true;

var saveLinkTimestamp = rev.Time;
if(rev.Fields.Count > 0)
{
// If this revision already has any fields, defer the link import by 2 miliseconds. Otherwise the Work Items API will
// send the response: "VS402625: Dates must be increasing with each revision"
saveLinkTimestamp = saveLinkTimestamp.AddMilliseconds(2);
}

foreach (var link in rev.Links)
{
try
Expand All @@ -676,11 +684,11 @@ private bool ApplyAndSaveLinks(WiRevision rev, WorkItem wi, Settings settings)
continue;
}

if (link.Change == ReferenceChangeType.Added && !_witClientUtils.AddAndSaveLink(link, wi, settings, rev.Author, rev.Time))
if (link.Change == ReferenceChangeType.Added && !_witClientUtils.AddAndSaveLink(link, wi, settings, rev.Author, saveLinkTimestamp))
{
success = false;
}
else if (link.Change == ReferenceChangeType.Removed && !_witClientUtils.RemoveAndSaveLink(link, wi, settings, rev.Author, rev.Time))
else if (link.Change == ReferenceChangeType.Removed && !_witClientUtils.RemoveAndSaveLink(link, wi, settings, rev.Author, saveLinkTimestamp))
{
success = false;
}
Expand All @@ -704,4 +712,4 @@ private bool ApplyAndSaveLinks(WiRevision rev, WorkItem wi, Settings settings)
}
#endregion
}
}
}
Loading