diff --git a/FatAntelope.CommandLine/Properties/AssemblyInfo.cs b/FatAntelope.CommandLine/Properties/AssemblyInfo.cs index 0c832c8..f55e2a6 100644 --- a/FatAntelope.CommandLine/Properties/AssemblyInfo.cs +++ b/FatAntelope.CommandLine/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("0.2.0.0")] -[assembly: AssemblyFileVersion("0.2.0.0")] +[assembly: AssemblyVersion("0.2.2.0")] +[assembly: AssemblyFileVersion("0.2.2.0")] diff --git a/FatAntelope/FatAntelope.csproj b/FatAntelope/FatAntelope.csproj index 71e6faa..4e33128 100644 --- a/FatAntelope/FatAntelope.csproj +++ b/FatAntelope/FatAntelope.csproj @@ -52,7 +52,6 @@ - diff --git a/FatAntelope/FatAntelope.nuspec b/FatAntelope/FatAntelope.nuspec new file mode 100644 index 0000000..8304777 --- /dev/null +++ b/FatAntelope/FatAntelope.nuspec @@ -0,0 +1,16 @@ + + + + $title$ + $version$ + $title$ + Cameron Wills + Cameron Wills + https://raw.githubusercontent.com/CameronWills/FatAntelope/master/LICENSE.md + https://github.com/CameronWills/FatAntelope + false + $description$ + Minor bug fixes and improvements to XDT output. + xdt config transform xml diff compare diffgram tree comparison cheetah slowcheetah + + \ No newline at end of file diff --git a/FatAntelope/Properties/AssemblyInfo.cs b/FatAntelope/Properties/AssemblyInfo.cs index 5a9abed..d4aeea2 100644 --- a/FatAntelope/Properties/AssemblyInfo.cs +++ b/FatAntelope/Properties/AssemblyInfo.cs @@ -6,7 +6,7 @@ // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("FatAntelope")] -[assembly: AssemblyDescription("")] +[assembly: AssemblyDescription("A tool for comparing two .config (xml) files and generating an XDT transform. Can also be used for unordered XML comparison, as an alternative to Microsoft's XML Diff tool. Extend BaseDiffWriter to create custom patches or diff grams.")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("FatAntelope")] @@ -32,5 +32,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("0.2.0.0")] -[assembly: AssemblyFileVersion("0.2.0.0")] +[assembly: AssemblyVersion("0.2.2.0")] +[assembly: AssemblyFileVersion("0.2.2.0")] diff --git a/FatAntelope/Writers/DebugDiffWriter.cs b/FatAntelope/Writers/DebugDiffWriter.cs deleted file mode 100644 index 39b9ad8..0000000 --- a/FatAntelope/Writers/DebugDiffWriter.cs +++ /dev/null @@ -1,50 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Xml; - -namespace FatAntelope.Writers -{ - public class DebugDiffWriter : BaseDiffWriter - { - public override void WriteDiff(XTree tree, string file) - { - using (var writer = XmlWriter.Create(file, new XmlWriterSettings() { Indent = true })) - { - writer.WriteStartDocument(); - WriteElement(tree.Root, writer); - writer.WriteEndDocument(); - } - } - - private void WriteElement(XNode node, XmlWriter writer) - { - writer.WriteStartElement(node.Name); - - foreach (var attr in node.Attributes) - { - if (attr.Match == MatchType.Change || attr.Match == MatchType.NoMatch) - writer.WriteAttributeString(attr.Name, attr.XmlNode.Value); - } - - foreach (var text in node.Texts) - { - if (text.Match == MatchType.Change || text.Match == MatchType.NoMatch) - writer.WriteValue(text.XmlNode.Value); - } - - foreach (var element in node.Elements) - { - if (element.Match == MatchType.Change) - WriteElement(element, writer); - - if (element.Match == MatchType.NoMatch) - writer.WriteRaw(element.XmlNode.OuterXml); - } - - writer.WriteEndElement(); - } - } -} diff --git a/FatAntelope/Writers/XdtDiffWriter.cs b/FatAntelope/Writers/XdtDiffWriter.cs index 9f44935..51c1654 100644 --- a/FatAntelope/Writers/XdtDiffWriter.cs +++ b/FatAntelope/Writers/XdtDiffWriter.cs @@ -445,7 +445,7 @@ private TransformType GetTransformType(XNode oldElement, XNode newElement) var attributes = GetCounts(oldElement.Attributes, newElement.Attributes); var elements = GetCounts(oldElement.Elements, newElement.Elements); - // If mostly only element inserts & deletes + // If mostly only element inserts & deletes, then replace if (elements.Deletes + elements.Inserts > 0 && elements.Unchanged + elements.Updates == 0 && attributes.Unchanged < elements.TotalChanges()) diff --git a/FatAntelope/XDiff.cs b/FatAntelope/XDiff.cs index 224d9cc..1d9a897 100644 --- a/FatAntelope/XDiff.cs +++ b/FatAntelope/XDiff.cs @@ -45,9 +45,9 @@ namespace FatAntelope { /// /// The XDiff algorithm for doing an unordered comparison of two xml documents and flaging the changed, inserted and deleted nodes. - /// I've ported this algorithm to C#, with some modifications, from the original XDiff algorithm by Yuan Wang described here: + /// A C# port, with some modifications, of the original X-Diff algorithm by Yuan Wang described here: /// http://pages.cs.wisc.edu/~yuanwang/xdiff.html - /// The matching algorithm uses the minimum-cost maximum flow algorithm when necessary, to find the minimum-cost bipartite mapping of the two trees. + /// The node matching logic uses the minimum-cost maximum flow algorithm when necessary, to find the minimum-cost bipartite mapping of the two trees. /// This gives an optimal matching of nodes between the two trees. /// public class XDiff @@ -83,7 +83,7 @@ public static void Diff(XTree tree1, XTree tree2) } /// - /// Compare and match the two nodes (and their children). + /// Compare and match the two elements (and their children). /// private static void DiffElements(XNode node1, XNode node2) { @@ -100,7 +100,7 @@ private static void DiffElements(XNode node1, XNode node2) SetMatching(node2.Attributes, MatchType.NoMatch); } - // Children = Elements and Text + // Handle child elements and Text // First, if no children if (node1.Children.Length == 0) diff --git a/FatAntelope/XNode.cs b/FatAntelope/XNode.cs index 2e21961..889f5b4 100644 --- a/FatAntelope/XNode.cs +++ b/FatAntelope/XNode.cs @@ -68,7 +68,7 @@ public class XNode public XNode Matching { get; set; } /// - /// Type (or strength) of match that this node has with it's 'Match' node + /// Type (or strength) of match that this node has with it's 'Matching' node /// public MatchType Match { get; set; } diff --git a/LICENCE.md b/LICENCE.md new file mode 100644 index 0000000..9bbb393 --- /dev/null +++ b/LICENCE.md @@ -0,0 +1,36 @@ +Copyright (c) 2015 + Cameron Wills. All rights reserved. + +Copyright (c) 2001 - 2005 + Yuan Wang. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: +1. Redistributions of source code must retain the above copyright notice, +this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright +notice, this list of conditions and the following disclaimer in the +documentation and/or other materials provided with the distribution. +3. Redistributions in any form must be accompanied by information on +how to obtain complete source code for the X-Diff software and any +accompanying software that uses the X-Diff software. The source code +must either be included in the distribution or be available for no +more than the cost of distribution plus a nominal fee, and must be +freely redistributable under reasonable conditions. For an executable +file, complete source code means the source code for all modules it +contains. It does not include source code for modules or files that +typically accompany the major components of the operating system on +which the executable file runs. + +THIS SOFTWARE IS PROVIDED BY YUAN WANG "AS IS" AND ANY EXPRESS OR IMPLIED +WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT, +ARE DISCLAIMED. IN NO EVENT SHALL YUAN WANG BE LIABLE FOR ANY DIRECT, +INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING +IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file