private static SymDiff <string> GetWitFieldDiff(WorkItemType srcWit, WorkItemType tarWit) { List <string> srcWitFields = new List <string>(); foreach (FieldDefinition fd in srcWit.FieldDefinitions) { srcWitFields.Add(fd.ReferenceName); } srcWitFields.Sort(); List <string> tarWitFields = new List <string>(); foreach (FieldDefinition fd in tarWit.FieldDefinitions) { tarWitFields.Add(fd.ReferenceName); } tarWitFields.Sort(); SymDiff <string> fieldDiff = new SymDiff <string>( srcWitFields.ToArray(), tarWitFields.ToArray(), StringComparer.InvariantCulture); return(fieldDiff); }
static void Main(string[] args) { if (args.Length != 6) { Console.WriteLine("Usage :"); Console.WriteLine("\t WitdDiff.exe sourceServerName sourceTeamProjectName sourceWitName targetServerName targetTeamProjectName targetWitName"); Console.WriteLine("\t Ex) WitdDiff.exe server1 tp1 Bug1 server2 tp2 Bug2"); Environment.Exit(0); } string sourceServer = args[0]; string sourceTP = args[1]; string sourceWitName = args[2]; string targetServer = args[3]; string targetTP = args[4]; string targetWitName = args[5]; WorkItemType srcWit = GetWorkItemType(sourceServer, sourceTP, sourceWitName); WorkItemType tarWit = GetWorkItemType(targetServer, targetTP, targetWitName); SymDiff <string> witFieldDiff = GetWitFieldDiff(srcWit, tarWit); PrintFieldDiff(witFieldDiff, srcWit, tarWit); PrintRequiredFields(srcWit); PrintRequiredFields(tarWit); }
private static void PrintFieldDiff(SymDiff <string> witFieldDiff, WorkItemType srcWit, WorkItemType tarWit) { Console.WriteLine("======== Left only fields ========"); Console.WriteLine("Server Name: " + srcWit.Store.TeamFoundationServer.Name); Console.WriteLine("WIT Name: " + srcWit.Name); Console.WriteLine(); foreach (string field in witFieldDiff.LeftOnly) { Console.WriteLine(field); } Console.WriteLine(); Console.WriteLine("======== Right only fields ========"); Console.WriteLine("Server Name: " + tarWit.Store.TeamFoundationServer.Name); Console.WriteLine("WIT Name: " + tarWit.Name); Console.WriteLine(); foreach (string field in witFieldDiff.RightOnly) { Console.WriteLine(field); } }