Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-moreorless for openSUSE:Factory checked in at 2022-09-30 17:57:40 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-moreorless (Old) and /work/SRC/openSUSE:Factory/.python-moreorless.new.2275 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-moreorless" Fri Sep 30 17:57:40 2022 rev:3 rq:1007056 version:0.4.0 Changes: -------- --- /work/SRC/openSUSE:Factory/python-moreorless/python-moreorless.changes 2021-01-26 14:49:44.947677555 +0100 +++ /work/SRC/openSUSE:Factory/.python-moreorless.new.2275/python-moreorless.changes 2022-09-30 17:57:58.877272575 +0200 @@ -1,0 +2,22 @@ +Thu Sep 29 16:39:39 UTC 2022 - Yogalakshmi Arunachalam <yarunacha...@suse.com> + +- Update to version 0.4.0 +- Enable CI on main branch +* Fix origin of misspelling in template generator +* Merge pull request #5 from jwilk-forks/spelling +* Fix typo +* Fix lint +* Remove test deps from runtime deps +* Switch to ufmt +* Don't prefix absolute paths. +* Merge pull request #4 from jreese/clicky +* Update docs, reduce extra code +* Add variant of echo_color_diff for precomputed diff results +* Add parameterized to dev requirements +* Document echo_color_unified_diff +* Also run CI on tmp- branches +* Add colored diffs, improve coverage +* Give meaningful error messages +* Support patches with non-overlapping offset + +------------------------------------------------------------------- Old: ---- moreorless-0.3.0.tar.gz New: ---- moreorless-0.4.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-moreorless.spec ++++++ --- /var/tmp/diff_new_pack.biyZ40/_old 2022-09-30 17:57:59.229273328 +0200 +++ /var/tmp/diff_new_pack.biyZ40/_new 2022-09-30 17:57:59.233273336 +0200 @@ -1,7 +1,7 @@ # # spec file for package python-moreorless # -# Copyright (c) 2021 SUSE LLC +# Copyright (c) 2022 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -19,7 +19,7 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} %define skip_python2 1 Name: python-moreorless -Version: 0.3.0 +Version: 0.4.0 Release: 0 Summary: Python diff wrapper License: MIT ++++++ moreorless-0.3.0.tar.gz -> moreorless-0.4.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/moreorless-0.3.0/Makefile new/moreorless-0.4.0/Makefile --- old/moreorless-0.3.0/Makefile 2020-03-08 05:56:12.000000000 +0100 +++ new/moreorless-0.4.0/Makefile 2021-03-30 16:54:02.000000000 +0200 @@ -21,13 +21,11 @@ .PHONY: format format: - python -m isort --recursive -y $(SOURCES) - python -m black $(SOURCES) + python -m ufmt format $(SOURCES) .PHONY: lint lint: - python -m isort --recursive --diff $(SOURCES) - python -m black --check $(SOURCES) + python -m ufmt check $(SOURCES) python -m flake8 $(SOURCES) mypy --strict moreorless diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/moreorless-0.3.0/PKG-INFO new/moreorless-0.4.0/PKG-INFO --- old/moreorless-0.3.0/PKG-INFO 2020-03-11 18:27:43.395472000 +0100 +++ new/moreorless-0.4.0/PKG-INFO 2021-03-30 17:08:49.079029600 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: moreorless -Version: 0.3.0 +Version: 0.4.0 Summary: Python diff wrapper Home-page: https://github.com/thatch/moreorless/ Author: Tim Hatch @@ -11,20 +11,22 @@ This is a thin wrapper around `difflib.unified_diff` that Does The Right Thing for "No newline at eof". The args are also simplified compared to `difflib`: - ``` + ```py moreorless.unified_diff( astr: str, bstr: str, filename: str, n: int = 3, - ) -> str + ) -> str: + ... # raises moreorless.patch.PatchException moreorless.patch.apply_single_file( contents: str, patch: str, allow_offsets: bool = True, - ) -> str + ) -> str: + ... # uses click to write to stdout with colors moreorless.click.echo_color_unified_diff( @@ -32,7 +34,14 @@ bstr: str, filename: str, n: int = 3 - ) -> None + ) -> None: + ... + + # if you want to use unified_diff yourself first (e.g. in another process) + moreorless.click.echo_color_precomputed_diff( + diff: str, + ) -> None: + ... ``` # License diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/moreorless-0.3.0/README.md new/moreorless-0.4.0/README.md --- old/moreorless-0.3.0/README.md 2020-03-11 18:17:47.000000000 +0100 +++ new/moreorless-0.4.0/README.md 2021-03-30 16:39:15.000000000 +0200 @@ -3,20 +3,22 @@ This is a thin wrapper around `difflib.unified_diff` that Does The Right Thing for "No newline at eof". The args are also simplified compared to `difflib`: -``` +```py moreorless.unified_diff( astr: str, bstr: str, filename: str, n: int = 3, -) -> str +) -> str: + ... # raises moreorless.patch.PatchException moreorless.patch.apply_single_file( contents: str, patch: str, allow_offsets: bool = True, -) -> str +) -> str: + ... # uses click to write to stdout with colors moreorless.click.echo_color_unified_diff( @@ -24,7 +26,14 @@ bstr: str, filename: str, n: int = 3 -) -> None +) -> None: + ... + +# if you want to use unified_diff yourself first (e.g. in another process) +moreorless.click.echo_color_precomputed_diff( + diff: str, +) -> None: + ... ``` # License diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/moreorless-0.3.0/moreorless/__init__.py new/moreorless-0.4.0/moreorless/__init__.py --- old/moreorless-0.3.0/moreorless/__init__.py 2020-03-09 15:56:50.000000000 +0100 +++ new/moreorless-0.4.0/moreorless/__init__.py 2021-03-30 16:54:02.000000000 +0200 @@ -1,9 +1,15 @@ import difflib +import os.path __all__ = ["unified_diff"] -def unified_diff(astr: str, bstr: str, filename: str, n: int = 3,) -> str: +def unified_diff( + astr: str, + bstr: str, + filename: str, + n: int = 3, +) -> str: """ Returns a unified diff string for the two inputs. @@ -12,12 +18,19 @@ Does handle the "no newline at end of file" properly UNLIKE DIFFLIB. """ + if os.path.isabs(filename): + a_filename = filename + b_filename = filename + else: + a_filename = f"a/{filename}" + b_filename = f"b/{filename}" + buf = [] gen = difflib.unified_diff( astr.splitlines(True), bstr.splitlines(True), - f"a/{filename}", - f"b/{filename}", + a_filename, + b_filename, n=n, ) for line in gen: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/moreorless-0.3.0/moreorless/click.py new/moreorless-0.4.0/moreorless/click.py --- old/moreorless-0.3.0/moreorless/click.py 2020-03-11 16:56:30.000000000 +0100 +++ new/moreorless-0.4.0/moreorless/click.py 2021-03-30 16:39:15.000000000 +0200 @@ -10,7 +10,14 @@ """ Just like `moreorless.unified_diff` except using `click.secho`. """ - for line in unified_diff(astr, bstr, filename, n).splitlines(True): + echo_color_precomputed_diff(unified_diff(astr, bstr, filename, n)) + + +def echo_color_precomputed_diff(diff: str) -> None: + """ + Like `echo_color_unified_diff`, but for precomputed diff results. + """ + for line in diff.splitlines(True): # TODO benchmark and see if constructing the string up front is faster if line.startswith("---") or line.startswith("+++"): click.secho(line, bold=True, nl=False) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/moreorless-0.3.0/moreorless/tests/click.py new/moreorless-0.4.0/moreorless/tests/click.py --- old/moreorless-0.3.0/moreorless/tests/click.py 2020-03-11 16:56:30.000000000 +0100 +++ new/moreorless-0.4.0/moreorless/tests/click.py 2021-03-30 16:39:15.000000000 +0200 @@ -2,7 +2,8 @@ from typing import Any from unittest.mock import call, patch -from ..click import echo_color_unified_diff +from .. import unified_diff +from ..click import echo_color_precomputed_diff, echo_color_unified_diff class ColorTest(unittest.TestCase): @@ -12,6 +13,21 @@ secho.assert_has_calls( [ call("--- a/x\n", bold=True, nl=False), + call("+++ b/x\n", bold=True, nl=False), + call("@@ -1,2 +1,2 @@\n", fg="cyan", nl=False), + call(" a\n", nl=False), + call("-b\n", fg="red", nl=False), + call("+c\n", fg="green", nl=False), + ] + ) + + @patch("click.secho") + def test_echo_color_precomputed_diff(self, secho: Any) -> None: + diff = unified_diff("a\nb\n", "a\nc\n", "x") + echo_color_precomputed_diff(diff) + secho.assert_has_calls( + [ + call("--- a/x\n", bold=True, nl=False), call("+++ b/x\n", bold=True, nl=False), call("@@ -1,2 +1,2 @@\n", fg="cyan", nl=False), call(" a\n", nl=False), diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/moreorless-0.3.0/moreorless/tests/general.py new/moreorless-0.4.0/moreorless/tests/general.py --- old/moreorless-0.3.0/moreorless/tests/general.py 2020-03-08 06:19:56.000000000 +0100 +++ new/moreorless-0.4.0/moreorless/tests/general.py 2021-03-30 17:06:19.000000000 +0200 @@ -10,7 +10,13 @@ class ParityTest(unittest.TestCase): @parameterized.expand( # type: ignore - [("a", "a"), ("a", "b"), ("a\n", "b"), ("a", "b\n"), ("a\n", "b\n"),] + [ + ("a", "a"), + ("a", "b"), + ("a\n", "b"), + ("a", "b\n"), + ("a\n", "b\n"), + ] ) def test_parity(self, a: str, b: str) -> None: with tempfile.TemporaryDirectory() as d: @@ -36,3 +42,16 @@ actual = unified_diff(a, b, "file") self.assertEqual(expected, actual) + + def test_absolute_paths(self) -> None: + actual = unified_diff("a\n", "a\nb\n", "/file") + self.assertEqual( + """\ +--- /file ++++ /file +@@ -1 +1,2 @@ + a ++b +""", + actual, + ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/moreorless-0.3.0/moreorless/tests/patch.py new/moreorless-0.4.0/moreorless/tests/patch.py --- old/moreorless-0.3.0/moreorless/tests/patch.py 2020-03-11 16:49:01.000000000 +0100 +++ new/moreorless-0.4.0/moreorless/tests/patch.py 2021-03-30 16:54:02.000000000 +0200 @@ -57,7 +57,12 @@ self.assertEqual(b, result) @parameterized.expand( # type: ignore - [(0,), (1,), (2,), (3,),] + [ + (0,), + (1,), + (2,), + (3,), + ] ) def test_exhaustive(self, context: int) -> None: for i in range(100): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/moreorless-0.3.0/moreorless.egg-info/PKG-INFO new/moreorless-0.4.0/moreorless.egg-info/PKG-INFO --- old/moreorless-0.3.0/moreorless.egg-info/PKG-INFO 2020-03-11 18:27:43.000000000 +0100 +++ new/moreorless-0.4.0/moreorless.egg-info/PKG-INFO 2021-03-30 17:08:48.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: moreorless -Version: 0.3.0 +Version: 0.4.0 Summary: Python diff wrapper Home-page: https://github.com/thatch/moreorless/ Author: Tim Hatch @@ -11,20 +11,22 @@ This is a thin wrapper around `difflib.unified_diff` that Does The Right Thing for "No newline at eof". The args are also simplified compared to `difflib`: - ``` + ```py moreorless.unified_diff( astr: str, bstr: str, filename: str, n: int = 3, - ) -> str + ) -> str: + ... # raises moreorless.patch.PatchException moreorless.patch.apply_single_file( contents: str, patch: str, allow_offsets: bool = True, - ) -> str + ) -> str: + ... # uses click to write to stdout with colors moreorless.click.echo_color_unified_diff( @@ -32,7 +34,14 @@ bstr: str, filename: str, n: int = 3 - ) -> None + ) -> None: + ... + + # if you want to use unified_diff yourself first (e.g. in another process) + moreorless.click.echo_color_precomputed_diff( + diff: str, + ) -> None: + ... ``` # License diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/moreorless-0.3.0/moreorless.egg-info/requires.txt new/moreorless-0.4.0/moreorless.egg-info/requires.txt --- old/moreorless-0.3.0/moreorless.egg-info/requires.txt 2020-03-11 18:27:43.000000000 +0100 +++ new/moreorless-0.4.0/moreorless.egg-info/requires.txt 2021-03-30 17:08:48.000000000 +0200 @@ -1,7 +1,4 @@ -parameterized click -volatile -parameterized [:python_version < "3.7"] dataclasses diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/moreorless-0.3.0/requirements-dev.txt new/moreorless-0.4.0/requirements-dev.txt --- old/moreorless-0.3.0/requirements-dev.txt 2020-03-11 16:51:15.000000000 +0100 +++ new/moreorless-0.4.0/requirements-dev.txt 2021-03-30 16:54:02.000000000 +0200 @@ -1,8 +1,10 @@ -black==19.10b0 +black==20.8b1 coverage==4.5.4 flake8==3.7.9 -isort==4.3.21 mypy==0.750 +parameterized==0.8.1 tox==3.14.1 twine==3.1.1 +ufmt==1.1 +usort==0.6.3 wheel==0.33.6 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/moreorless-0.3.0/setup.cfg new/moreorless-0.4.0/setup.cfg --- old/moreorless-0.3.0/setup.cfg 2020-03-11 18:27:43.398805400 +0100 +++ new/moreorless-0.4.0/setup.cfg 2021-03-30 17:08:49.082363000 +0200 @@ -16,11 +16,8 @@ python_requires = >=3.6 include_package_data = true install_requires = - parameterized dataclasses; python_version < "3.7" click - volatile - parameterized [bdist_wheel] universal = true