From 62628614570d3e5889e31f81ec6302249bfea750 Mon Sep 17 00:00:00 2001 From: Bastien Abadie Date: Wed, 5 Feb 2020 09:21:12 +0100 Subject: [PATCH] Use patience diff algorithm, refs #53. --- requirements.txt | 8 ++++++++ setup.py | 1 + tcadmin/diff.py | 4 ++-- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/requirements.txt b/requirements.txt index cbf3d2db..1776cb62 100644 --- a/requirements.txt +++ b/requirements.txt @@ -109,6 +109,14 @@ packaging==19.2 \ --hash=sha256:28b924174df7a2fa32c1953825ff29c61e2f5e082343165438812f00d3a7fc47 \ --hash=sha256:d9551545c6d761f3def1677baf08ab2a3ca17c56879e70fecba2fc4dde4ed108 \ # via pytest +patiencediff==0.1.0 \ + --hash=sha256:050eec9ab2bf6901559aff5d5fdc9a5f55a391e68959a3802ff8f29ae123974b \ + --hash=sha256:0ef76135639659a2bdbfa3a10cfae9e4753302838a62d083db8b44eab3de5547 \ + --hash=sha256:2f5f96358a70ad81220104c9477a401c86cc342abbd14cb89405448311f53e09 \ + --hash=sha256:7cd316f57f7b4086923cc0db80273886416134d82945dddd0aa24f0e95c7d302 \ + --hash=sha256:956bbd7451044e8902cdde671c24429c242b035a42d5f40f3c547223d0badba2 \ + --hash=sha256:bfb5bf7f5b494ba3a02d64a034ca76a9d90cee73b9a9a2b8318a9eaa00331306 \ + --hash=sha256:cc85f98291a2555f33764c7d16ca853754669d5117ce0f3e0066a966761d0962 pluggy==0.13.0 \ --hash=sha256:0db4b7601aae1d35b4a033282da476845aa19185c1e6964b25cf324b5e4ec3e6 \ --hash=sha256:fa5fa1622fa6dd5c030e9cad086fa19ef6a0cf6d7a2d12318e10cb49d6d68f34 \ diff --git a/setup.py b/setup.py index ad963efe..0c71736d 100644 --- a/setup.py +++ b/setup.py @@ -23,6 +23,7 @@ "aiohttp~=2.3.10", "pytest~=5.2", "pyyaml~=4.2b1", + "patiencediff==0.1.0", ], setup_requires=["pytest-runner", "flake8"], tests_require=["pytest", "pytest-mock", "pytest-asyncio~=0.10.0", "flake8"], diff --git a/tcadmin/diff.py b/tcadmin/diff.py index ad2b8c47..bca273d6 100644 --- a/tcadmin/diff.py +++ b/tcadmin/diff.py @@ -6,7 +6,7 @@ import re import click -import difflib +import patiencediff import blessings import attr @@ -95,7 +95,7 @@ def contextualize(rangeInfo): return match.group(1) return "" - lines = difflib.unified_diff( + lines = patiencediff.unified_diff( left, right, lineterm="", fromfile="current", tofile="generated", n=context ) colors = {