private void UpdateActionDescription(Field f, IMigrationAction action, object newValue) { TraceManager.TraceInformation("Correcting field '{0}' with new value '{1}'", f.ReferenceName, newValue ?? "null"); XmlNode fieldCol = action.MigrationActionDescription.SelectSingleNode( string.Format("/WorkItemChanges/Columns/Column[@ReferenceName='{0}']", f.ReferenceName)); if (fieldCol == null) { // field column does not exist in the update document XmlNode columnsNode = action.MigrationActionDescription.SelectSingleNode("/WorkItemChanges/Columns"); var newFieldCol = (newValue == null) ? TfsMigrationWorkItem.CreateFieldColumn(action.MigrationActionDescription, f) : TfsMigrationWorkItem.CreateFieldColumn(action.MigrationActionDescription, f, newValue); columnsNode.AppendChild(newFieldCol); } else { object translatedValue = (newValue == null) ? TfsMigrationWorkItem.TranslateFieldValue(f) : TfsMigrationWorkItem.TranslateFieldValue(f, newValue); string updatedFieldValue = (translatedValue == null ? string.Empty : translatedValue.ToString()); fieldCol.FirstChild.InnerText = updatedFieldValue; } }
private void ExtractFieldDetails(WorkItem tfsWorkItem, int revision, bool useDeltaComputeFieldSkipLogic) { IsRevisionValid(tfsWorkItem, revision); Revision rev = tfsWorkItem.Revisions[revision - 1]; foreach (Field field in rev.Fields) { if (useDeltaComputeFieldSkipLogic) { if (TfsMigrationWorkItem.MustTakeTfsField(field.FieldDefinition)) { AddField(field.ReferenceName, field.Name, field.FieldDefinition.FieldType.ToString(), (field.Value == null) ? string.Empty : field.Value.ToString()); } } else { if (!field.IsComputed || string.Equals(field.ReferenceName, "System.AreaPath", StringComparison.OrdinalIgnoreCase) || string.Equals(field.ReferenceName, "System.IterationPath", StringComparison.OrdinalIgnoreCase)) { AddField(field.ReferenceName, field.Name, field.FieldDefinition.FieldType.ToString(), (field.Value == null) ? string.Empty : field.Value.ToString()); } } } }
/// <summary> /// extract un-synced revisions with details of the item and persist them to db /// </summary> /// <param name="item"></param> /// <param name="tfsWitWaterMark"></param> /// <returns></returns> private List <ChangeGroup> ComputeDelta(TfsMigrationWorkItem item, DateTime waterMarkChangeStartTime) { List <ChangeGroup> groups = new List <ChangeGroup>(); ComputeFieldDelta(item, waterMarkChangeStartTime, groups); ComputeAttachmentDelta(item, waterMarkChangeStartTime, groups); return(groups); }
private void ComputeAttachmentDelta(TfsMigrationWorkItem item, DateTime waterMarkChangeStartTime, List <ChangeGroup> groups) { if (!m_supportedChangeActionsOther.Contains(WellKnownChangeActionId.AddAttachment) && !m_supportedChangeActionsOther.Contains(WellKnownChangeActionId.DelAttachment)) { return; } item.ComputeAttachmentDelta(m_changeGroupService, waterMarkChangeStartTime, TranslationService, m_configurationService.SourceId, groups); }
private void ComputeFieldDelta(TfsMigrationWorkItem item, DateTime waterMarkChangeStartTime, List <ChangeGroup> groups) { TraceManager.TraceInformation(string.Format( "Start generating revision delta information for Work Item #{0} at {1}", item.WorkItem.Id, DateTime.Now.ToString("o"))); item.ComputeFieldDelta(m_changeGroupService, waterMarkChangeStartTime, TfsValueComparer, TranslationService, m_configurationService, groups, IsWorkItemRevisionProcessed); }