Hello community, here is the log from the commit of package python-xmldiff for openSUSE:Factory checked in at 2019-10-31 18:18:10 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-xmldiff (Old) and /work/SRC/openSUSE:Factory/.python-xmldiff.new.2990 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-xmldiff" Thu Oct 31 18:18:10 2019 rev:18 rq:744160 version:2.4 Changes: -------- --- /work/SRC/openSUSE:Factory/python-xmldiff/python-xmldiff.changes 2019-05-06 21:17:03.337042195 +0200 +++ /work/SRC/openSUSE:Factory/.python-xmldiff.new.2990/python-xmldiff.changes 2019-10-31 18:18:25.766207667 +0100 @@ -1,0 +2,7 @@ +Wed Oct 30 12:37:21 UTC 2019 - Tomáš Chvátal <[email protected]> + +- Update to 2.4: + * Added an option to pass pairs of (element, attr) as unique + attributes for tree matching. + +------------------------------------------------------------------- Old: ---- xmldiff-2.3.tar.gz New: ---- xmldiff-2.4.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-xmldiff.spec ++++++ --- /var/tmp/diff_new_pack.KxjsrO/_old 2019-10-31 18:18:26.986208929 +0100 +++ /var/tmp/diff_new_pack.KxjsrO/_new 2019-10-31 18:18:26.998208943 +0100 @@ -19,11 +19,10 @@ %define oldpython python %{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-xmldiff -Version: 2.3 +Version: 2.4 Release: 0 Summary: Tree to tree correction between XML documents License: MIT -Group: Development/Languages/Python URL: https://github.com/Shoobx/xmldiff Source: https://files.pythonhosted.org/packages/source/x/xmldiff/xmldiff-%{version}.tar.gz BuildRequires: %{python_module setuptools} ++++++ xmldiff-2.3.tar.gz -> xmldiff-2.4.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmldiff-2.3/CHANGES.rst new/xmldiff-2.4/CHANGES.rst --- old/xmldiff-2.3/CHANGES.rst 2019-02-27 12:49:42.000000000 +0100 +++ new/xmldiff-2.4/CHANGES.rst 2019-10-09 11:40:55.000000000 +0200 @@ -1,6 +1,13 @@ Changes ======= +2.4 (2019-10-09) +---------------- + +- Added an option to pass pairs of (element, attr) as unique + attributes for tree matching. Exposed this option on the command + line, too. + 2.3 (2019-02-27) ---------------- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmldiff-2.3/PKG-INFO new/xmldiff-2.4/PKG-INFO --- old/xmldiff-2.3/PKG-INFO 2019-02-27 12:49:43.000000000 +0100 +++ new/xmldiff-2.4/PKG-INFO 2019-10-09 11:40:56.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: xmldiff -Version: 2.3 +Version: 2.4 Summary: Creates diffs of XML files Home-page: https://github.com/Shoobx/xmldiff Author: Lennart Regebro @@ -18,7 +18,7 @@ ``xmldiff`` is a library and a command-line utility for making diffs out of XML. This may seem like something that doesn't need a dedicated utility, but change detection in hierarchical data is very different from change detection in flat data. - XML type formats are also not only used for computer readable0 data, + XML type formats are also not only used for computer readable data, it is also often used as a format for hierarchical data that can be rendered into human readable formats. A traditional diff on such a format would tell you line by line the differences, but this would not be be readable by a human. @@ -40,7 +40,7 @@ There is also a command to patch a file with the output from the ``xmldiff`` command:: - $ xmldiff file.diff file1.xml + $ xmlpatch file.diff file1.xml There is a simple API for using ``xmldiff`` as a library:: @@ -52,9 +52,9 @@ There is also a method ``diff_trees()`` that take two lxml trees, and a method ``diff_texts()`` that will take strings containing XML. - Similarily, there is ``patch_file()`` ``patch_text()`` and ``patch_tree()``:: + Similarly, there is ``patch_file()`` ``patch_text()`` and ``patch_tree()``:: - result = main.diff_file('file.diff', 'file1.xml') + result = main.patch_file('file.diff', 'file1.xml') Changes from ``xmldiff`` 0.6/1.x @@ -77,7 +77,7 @@ * An output format compatible with 0.6/1.x is also available. - * 2.0 is urrently significantly slower than ``xmldiff`` 0.6/1.x, + * 2.0 is currently significantly slower than ``xmldiff`` 0.6/1.x, but this will change in the future. Currently we make no effort to make ``xmldiff`` 2.0 fast, we concentrate on making it correct and usable. @@ -86,16 +86,25 @@ Contributors ------------ - * Lennart Regebro, [email protected] (main author) + * Lennart Regebro, [email protected] (main author) * Stephan Richter, [email protected] + * Albertas Agejevas, [email protected] + The diff algorithm is based on "`Change Detection in Hierarchically Structured Information <http://ilpubs.stanford.edu/115/1/1995-46.pdf>`_", and the text diff is using Google's ``diff_match_patch`` algorithm. Changes ======= + 2.4 (2019-10-09) + ---------------- + + - Added an option to pass pairs of (element, attr) as unique + attributes for tree matching. Exposed this option on the command + line, too. + 2.3 (2019-02-27) ---------------- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmldiff-2.3/README.rst new/xmldiff-2.4/README.rst --- old/xmldiff-2.3/README.rst 2019-02-27 12:49:42.000000000 +0100 +++ new/xmldiff-2.4/README.rst 2019-10-09 11:40:55.000000000 +0200 @@ -10,7 +10,7 @@ ``xmldiff`` is a library and a command-line utility for making diffs out of XML. This may seem like something that doesn't need a dedicated utility, but change detection in hierarchical data is very different from change detection in flat data. -XML type formats are also not only used for computer readable0 data, +XML type formats are also not only used for computer readable data, it is also often used as a format for hierarchical data that can be rendered into human readable formats. A traditional diff on such a format would tell you line by line the differences, but this would not be be readable by a human. @@ -32,7 +32,7 @@ There is also a command to patch a file with the output from the ``xmldiff`` command:: - $ xmldiff file.diff file1.xml + $ xmlpatch file.diff file1.xml There is a simple API for using ``xmldiff`` as a library:: @@ -44,9 +44,9 @@ There is also a method ``diff_trees()`` that take two lxml trees, and a method ``diff_texts()`` that will take strings containing XML. -Similarily, there is ``patch_file()`` ``patch_text()`` and ``patch_tree()``:: +Similarly, there is ``patch_file()`` ``patch_text()`` and ``patch_tree()``:: - result = main.diff_file('file.diff', 'file1.xml') + result = main.patch_file('file.diff', 'file1.xml') Changes from ``xmldiff`` 0.6/1.x @@ -69,7 +69,7 @@ * An output format compatible with 0.6/1.x is also available. - * 2.0 is urrently significantly slower than ``xmldiff`` 0.6/1.x, + * 2.0 is currently significantly slower than ``xmldiff`` 0.6/1.x, but this will change in the future. Currently we make no effort to make ``xmldiff`` 2.0 fast, we concentrate on making it correct and usable. @@ -78,9 +78,11 @@ Contributors ------------ - * Lennart Regebro, [email protected] (main author) + * Lennart Regebro, [email protected] (main author) * Stephan Richter, [email protected] + * Albertas Agejevas, [email protected] + The diff algorithm is based on "`Change Detection in Hierarchically Structured Information <http://ilpubs.stanford.edu/115/1/1995-46.pdf>`_", and the text diff is using Google's ``diff_match_patch`` algorithm. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmldiff-2.3/docs/source/advanced.rst new/xmldiff-2.4/docs/source/advanced.rst --- old/xmldiff-2.3/docs/source/advanced.rst 2019-02-27 12:49:42.000000000 +0100 +++ new/xmldiff-2.4/docs/source/advanced.rst 2019-10-09 11:40:55.000000000 +0200 @@ -120,7 +120,7 @@ The XSLT template above of course only handles a few cases, like inserted formatting and insert and delete tags (used below). -A more complete XSLT file is included `here <file:_static/htmlformatter.xslt>`_. +A more complete XSLT file is included `here <https://github.com/Shoobx/xmldiff/blob/master/docs/source/static/htmlformatter.xslt>`_. Now use that formatter in the diffing: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmldiff-2.3/docs/source/api.rst new/xmldiff-2.4/docs/source/api.rst --- old/xmldiff-2.3/docs/source/api.rst 2019-02-27 12:49:42.000000000 +0100 +++ new/xmldiff-2.4/docs/source/api.rst 2019-10-09 11:40:55.000000000 +0200 @@ -71,7 +71,7 @@ ``fast_match``: By default ``xmldiff`` will compare each node from one tree with all nodes from the other tree. It will then pick the one node that matches best as the match, - if that match passes the match treshold ``F`` (see above). + if that match passes the match threshold ``F`` (see above). If fast_match is true ``xmldiff`` will first make a faster run, trying to find chains of matching nodes, @@ -98,7 +98,7 @@ and no guarantees are done that the output of one version will be the same as the output of any previous version. The actions of the edit script can be in a different order or replaced by equivalent actions dependingon the version of ``xmldiff``, but if the Edit Script does not correctly transform one XML tree into another, -thas is regarded as a bug. +that is regarded as a bug. This means that the output of the ``xml`` format also may change from version to version. There is no "correct" solution to how that output should look, as the same change can be represented in several different ways. @@ -107,11 +107,17 @@ Unique Attributes ----------------- -The ``uniqueattrs`` argument is a list of strings specifying attributes that uniquely identify a node in the document. +The ``uniqueattrs`` argument is a list of strings or ``(tag, attribute)`` tuples +specifying attributes that uniquely identify a node in the document. This is used by the differ when trying to match nodes. If one node in the left tree has a this attribute, the node in the right three with the same value for that attribute will match, regardless of other attributes, child nodes or text content. +Respectively, if the values of the attribute on the nodes in question are different, +or if only one of the nodes has this attribute, +the nodes will not match regardless of their structural similarity. +In case the attribute is a tuple, the attribute match applies only if both nodes +have the given tag. The default is ``['{http://www.w3.org/XML/1998/namespace}id']``, which is the ``xml:id`` attribute. @@ -463,7 +469,7 @@ * ``xmldiff.main.patch_tree()`` takes as input one edit script, (ie a list of actions, see above) and one ``lxml`` tree, - and returnes a patched ``lxml`` tree. + and returns a patched ``lxml`` tree. They all return a string with the patched XML tree. There are currently no configuration parameters for these commands. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmldiff-2.3/docs/source/installation.rst new/xmldiff-2.4/docs/source/installation.rst --- old/xmldiff-2.3/docs/source/installation.rst 2019-02-27 12:49:42.000000000 +0100 +++ new/xmldiff-2.4/docs/source/installation.rst 2019-10-09 11:40:55.000000000 +0200 @@ -13,7 +13,7 @@ That's it, ``xmldiff`` should now be available for you to use. -Several Unix distributions also include ``xmldiff`` so you can install it with your distrubutions package manager. +Several Unix distributions also include ``xmldiff`` so you can install it with your distributions package manager. Be aware that currently most distribute an earlier version, typically 0.6.10, which is very different from 2.x, which this documentation is written for. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmldiff-2.3/setup.py new/xmldiff-2.4/setup.py --- old/xmldiff-2.3/setup.py 2019-02-27 12:49:42.000000000 +0100 +++ new/xmldiff-2.4/setup.py 2019-10-09 11:40:55.000000000 +0200 @@ -1,7 +1,7 @@ from io import open from setuptools import setup, find_packages -version = '2.3' +version = '2.4' with open('README.rst', 'rt', encoding='utf8') as readme: description = readme.read() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmldiff-2.3/tests/test_diff.py new/xmldiff-2.4/tests/test_diff.py --- old/xmldiff-2.3/tests/test_diff.py 2019-02-27 12:49:42.000000000 +0100 +++ new/xmldiff-2.4/tests/test_diff.py 2019-10-09 11:40:55.000000000 +0200 @@ -13,6 +13,20 @@ from .testing import compare_elements +def dedent(string): + """Remove the maximum common indent of the lines making up the string.""" + lines = string.splitlines() + indent = min( + len(line) - len(line.lstrip()) + for line in lines + if line + ) + return "\n".join( + line[indent:] if line else line + for line in lines + ) + + class APITests(unittest.TestCase): left = u"<document><p>Text</p><p>More</p></document>" right = u"<document><p>Tokst</p><p>More</p></document>" @@ -302,6 +316,91 @@ self.assertEqual(differ.child_ratio(left, right), 1.0) self.assertEqual(differ.node_ratio(left, right), 0) + def test_compare_with_uniqueattrs(self): + # `uniqueattrs` can be pairs of (tag, attribute) as well as just string + # attributes. + left = dedent(u"""\ + <document> + <story firstPageTemplate="FirstPage"> + <section name="oldfirst" ref="1" single-ref="1"> + <para>First paragraph</para> + <para>This is the second paragraph</para> + </section> + <section ref="3" single-ref="3" name="tobedeleted"> + <para>Det tredje stycket</para> + </section> + <section name="last" ref="4" single-ref="4"> + <para>Last paragraph</para> + </section> + </story> + </document> + """) + + right = dedent(u"""\ + <document> + <story firstPageTemplate="FirstPage"> + <section name="newfirst" ref="1" single-ref="1"> + <para>First paragraph</para> + </section> + <section name="oldfirst" single-ref="2" ref="2"> + <para>This is the second</para> + <para>Det tredje stycket</para> + </section> + <section single-ref="4" ref="4"> + <para>Last paragraph</para> + </section> + <subsection name="oldfirst" ref="1" single-ref="1"> + <para>First paragraph</para> + <para>This is the second paragraph</para> + </subsection> + </story> + </document> + """) + + differ = Differ(uniqueattrs=[ + ('section', 'name'), + '{http://www.w3.org/XML/1998/namespace}id' + ]) + differ.set_trees(etree.fromstring(left), etree.fromstring(right)) + differ.match() + + # Make some choice comparisons here. + + left = differ.left.xpath('/document/story/section[1]')[0] + right = differ.right.xpath('/document/story/section[1]')[0] + + # These are very similar + self.assertEqual(differ.leaf_ratio(left, right), 0.90625) + # And one out of two children in common + self.assertEqual(differ.child_ratio(left, right), 0.5) + # But different names, hence 0 as match + self.assertEqual(differ.node_ratio(left, right), 0) + + # Here's the ones with the same tag and name attribute: + left = differ.left.xpath('/document/story/section[1]')[0] + right = differ.right.xpath('/document/story/section[2]')[0] + + # Only one out of two children in common + self.assertEqual(differ.child_ratio(left, right), 0) + # But same id's, hence 1 as match + self.assertEqual(differ.node_ratio(left, right), 1.0) + + # The last ones are completely similar, but only one + # has an name, so they do not match. + left = differ.left.xpath('/document/story/section[3]')[0] + right = differ.right.xpath('/document/story/section[3]')[0] + self.assertAlmostEqual(differ.leaf_ratio(left, right), 0.78260869565) + self.assertEqual(differ.child_ratio(left, right), 1.0) + self.assertEqual(differ.node_ratio(left, right), 0) + + # Now these are structurally similar, have the same name, but + # one of them is not a section, so the uniqueattr does not match + left = differ.left.xpath('/document/story/section[1]')[0] + right = differ.right.xpath('/document/story/subsection[1]')[0] + self.assertAlmostEqual(differ.leaf_ratio(left, right), 1.0) + self.assertEqual(differ.child_ratio(left, right), 0.5) + self.assertAlmostEqual(differ.node_ratio(left, right), 0.75) + def test_compare_node_rename(self): left = u"""<document> <para>First paragraph</para> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmldiff-2.3/xmldiff/_diff_match_patch_py2.py new/xmldiff-2.4/xmldiff/_diff_match_patch_py2.py --- old/xmldiff-2.3/xmldiff/_diff_match_patch_py2.py 2019-02-27 12:49:42.000000000 +0100 +++ new/xmldiff-2.4/xmldiff/_diff_match_patch_py2.py 2019-10-09 11:40:55.000000000 +0200 @@ -959,7 +959,7 @@ pointer += 1 text_insert = text_insert[commonlength:] text_delete = text_delete[commonlength:] - # Factor out any common suffixies. + # Factor out any common suffixes. commonlength = self.diff_commonSuffix(text_insert, text_delete) if commonlength != 0: diffs[pointer] = (diffs[pointer][0], text_insert[-commonlength:] + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmldiff-2.3/xmldiff/_diff_match_patch_py3.py new/xmldiff-2.4/xmldiff/_diff_match_patch_py3.py --- old/xmldiff-2.3/xmldiff/_diff_match_patch_py3.py 2019-02-27 12:49:42.000000000 +0100 +++ new/xmldiff-2.4/xmldiff/_diff_match_patch_py3.py 2019-10-09 11:40:55.000000000 +0200 @@ -957,7 +957,7 @@ pointer += 1 text_insert = text_insert[commonlength:] text_delete = text_delete[commonlength:] - # Factor out any common suffixies. + # Factor out any common suffixes. commonlength = self.diff_commonSuffix(text_insert, text_delete) if commonlength != 0: diffs[pointer] = (diffs[pointer][0], text_insert[-commonlength:] + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmldiff-2.3/xmldiff/diff.py new/xmldiff-2.4/xmldiff/diff.py --- old/xmldiff-2.3/xmldiff/diff.py 2019-02-27 12:49:42.000000000 +0100 +++ new/xmldiff-2.4/xmldiff/diff.py 2019-10-09 11:40:55.000000000 +0200 @@ -14,8 +14,9 @@ if F is None: F = 0.5 self.F = F - # uniquattrs is a list of attributes that uniquely identifies a node - # inside a document. Defaults to 'xml:id'. + # uniqueattrs is a list of attributes or (tag, attribute) pairs + # that uniquely identifies a node inside a document. Defaults + # to 'xml:id'. if uniqueattrs is None: uniqueattrs = ['{http://www.w3.org/XML/1998/namespace}id'] self.uniqueattrs = uniqueattrs @@ -162,6 +163,12 @@ return 0 for attr in self.uniqueattrs: + if not isinstance(attr, str): + # If it's actually a sequence of (tag, attr), the tags must + # match first. + tag, attr = attr + if tag != left.tag or tag != right.tag: + continue if attr in left.attrib or attr in right.attrib: # One of the nodes have a unique attribute, we check only that. # If only one node has it, it means they are not the same. @@ -258,6 +265,8 @@ yield actions.RenameAttrib(left_xpath, lk, rk) # Remove from list of new attributes new_keys.remove(rk) + # Delete used attribute from map of attributes + del newattrmap[value] # Update left node left.attrib[rk] = value del left.attrib[lk] @@ -345,7 +354,7 @@ # Go over those children that are not in order: for lchild in lchildren: if lchild in self._inorder: - # Alrady aligned + # Already aligned continue rchild = self._l2rmap[id(lchild)] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmldiff-2.3/xmldiff/formatting.py new/xmldiff-2.4/xmldiff/formatting.py --- old/xmldiff-2.3/xmldiff/formatting.py 2019-02-27 12:49:42.000000000 +0100 +++ new/xmldiff-2.4/xmldiff/formatting.py 2019-10-09 11:40:55.000000000 +0200 @@ -369,7 +369,7 @@ def _xpath(self, node, xpath): # This method finds an element with xpath and makes sure that # one and exactly one element is found. This is to protect against - # formatting a diff on the wrong tree, or against using ambigous + # formatting a diff on the wrong tree, or against using ambiguous # edit script xpaths. if xpath[0] == '/': root = True diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmldiff-2.3/xmldiff/main.py new/xmldiff-2.4/xmldiff/main.py --- old/xmldiff-2.3/xmldiff/main.py 2019-02-27 12:49:42.000000000 +0100 +++ new/xmldiff-2.4/xmldiff/main.py 2019-10-09 11:40:55.000000000 +0200 @@ -71,12 +71,14 @@ parser.add_argument('-p', '--pretty-print', action='store_true', help='Try to make XML output more readable.') parser.add_argument('-F', type=float, - help='A value betwen 0 and 1 that determines how ' + help='A value between 0 and 1 that determines how ' 'similar nodes must be to match.') parser.add_argument('--unique-attributes', type=str, nargs='?', default='{http://www.w3.org/XML/1998/namespace}id', help='A comma separated list of attributes ' - 'that uniquely identify a node. Can be empty.') + 'that uniquely identify a node. Can be empty. ' + 'Unique attributes for certain elements can ' + 'be specified in the format {NS}element@attr.') parser.add_argument('--ratio-mode', default='fast', choices={'accurate', 'fast', 'faster'}, help='Choose the node comparison optimization.') @@ -85,6 +87,15 @@ return parser +def _parse_uniqueattrs(uniqueattrs): + if uniqueattrs is None: + return [] + return [ + attr if '@' not in attr else attr.split('@', 1) + for attr in uniqueattrs.split(',') + ] + + def diff_command(args=None): parser = make_diff_parser() args = parser.parse_args(args=args) @@ -97,15 +108,10 @@ formatter = FORMATTERS[args.formatter](normalize=normalize, pretty_print=args.pretty_print) - if args.unique_attributes is None: - uniqueattrs = [] - else: - uniqueattrs = args.unique_attributes.split(',') - diff_options = {'ratio_mode': args.ratio_mode, 'F': args.F, 'fast_match': args.fast_match, - 'uniqueattrs': uniqueattrs, + 'uniqueattrs': _parse_uniqueattrs(args.unique_attributes), } result = diff_files(args.file1, args.file2, diff_options=diff_options, formatter=formatter) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmldiff-2.3/xmldiff/utils.py new/xmldiff-2.4/xmldiff/utils.py --- old/xmldiff-2.3/xmldiff/utils.py 2019-02-27 12:49:42.000000000 +0100 +++ new/xmldiff-2.4/xmldiff/utils.py 2019-10-09 11:40:55.000000000 +0200 @@ -58,7 +58,7 @@ lmax = len(left) rmax = len(right) - furtherst = {1: (0, [])} + furthest = {1: (0, [])} if not lmax + rmax: # The sequences are equal @@ -68,13 +68,13 @@ for d in range(0, lmax + rmax + 1): for k in range(-d, d + 1, 2): if (k == -d or - (k != d and furtherst[k - 1][0] < furtherst[k + 1][0])): + (k != d and furthest[k - 1][0] < furthest[k + 1][0])): # Go down - old_x, history = furtherst[k + 1] + old_x, history = furthest[k + 1] x = old_x else: # Go left - old_x, history = furtherst[k - 1] + old_x, history = furthest[k - 1] x = old_x + 1 # Copy the history @@ -92,7 +92,7 @@ return [(e, e) for e in range(start)] + history + \ list(zip(range(lend, lslen), range(rend, rslen))) else: - furtherst[k] = (x, history) + furthest[k] = (x, history) WHITESPACE = re.compile(u'\\s+', flags=re.MULTILINE) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmldiff-2.3/xmldiff.egg-info/PKG-INFO new/xmldiff-2.4/xmldiff.egg-info/PKG-INFO --- old/xmldiff-2.3/xmldiff.egg-info/PKG-INFO 2019-02-27 12:49:43.000000000 +0100 +++ new/xmldiff-2.4/xmldiff.egg-info/PKG-INFO 2019-10-09 11:40:56.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: xmldiff -Version: 2.3 +Version: 2.4 Summary: Creates diffs of XML files Home-page: https://github.com/Shoobx/xmldiff Author: Lennart Regebro @@ -18,7 +18,7 @@ ``xmldiff`` is a library and a command-line utility for making diffs out of XML. This may seem like something that doesn't need a dedicated utility, but change detection in hierarchical data is very different from change detection in flat data. - XML type formats are also not only used for computer readable0 data, + XML type formats are also not only used for computer readable data, it is also often used as a format for hierarchical data that can be rendered into human readable formats. A traditional diff on such a format would tell you line by line the differences, but this would not be be readable by a human. @@ -40,7 +40,7 @@ There is also a command to patch a file with the output from the ``xmldiff`` command:: - $ xmldiff file.diff file1.xml + $ xmlpatch file.diff file1.xml There is a simple API for using ``xmldiff`` as a library:: @@ -52,9 +52,9 @@ There is also a method ``diff_trees()`` that take two lxml trees, and a method ``diff_texts()`` that will take strings containing XML. - Similarily, there is ``patch_file()`` ``patch_text()`` and ``patch_tree()``:: + Similarly, there is ``patch_file()`` ``patch_text()`` and ``patch_tree()``:: - result = main.diff_file('file.diff', 'file1.xml') + result = main.patch_file('file.diff', 'file1.xml') Changes from ``xmldiff`` 0.6/1.x @@ -77,7 +77,7 @@ * An output format compatible with 0.6/1.x is also available. - * 2.0 is urrently significantly slower than ``xmldiff`` 0.6/1.x, + * 2.0 is currently significantly slower than ``xmldiff`` 0.6/1.x, but this will change in the future. Currently we make no effort to make ``xmldiff`` 2.0 fast, we concentrate on making it correct and usable. @@ -86,16 +86,25 @@ Contributors ------------ - * Lennart Regebro, [email protected] (main author) + * Lennart Regebro, [email protected] (main author) * Stephan Richter, [email protected] + * Albertas Agejevas, [email protected] + The diff algorithm is based on "`Change Detection in Hierarchically Structured Information <http://ilpubs.stanford.edu/115/1/1995-46.pdf>`_", and the text diff is using Google's ``diff_match_patch`` algorithm. Changes ======= + 2.4 (2019-10-09) + ---------------- + + - Added an option to pass pairs of (element, attr) as unique + attributes for tree matching. Exposed this option on the command + line, too. + 2.3 (2019-02-27) ----------------
