Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-dunamai for openSUSE:Factory checked in at 2024-04-21 20:27:37 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-dunamai (Old) and /work/SRC/openSUSE:Factory/.python-dunamai.new.26366 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-dunamai" Sun Apr 21 20:27:37 2024 rev:3 rq:1169374 version:1.20.0 Changes: -------- --- /work/SRC/openSUSE:Factory/python-dunamai/python-dunamai.changes 2024-02-18 20:25:13.446458792 +0100 +++ /work/SRC/openSUSE:Factory/.python-dunamai.new.26366/python-dunamai.changes 2024-04-21 20:29:10.398087824 +0200 @@ -1,0 +2,7 @@ +Sat Apr 20 14:07:58 UTC 2024 - Dirk Müller <dmuel...@suse.com> + +- update to 1.20.0: + * Updated `Version.bump()` to add a `smart` argument, + which only bumps when `distance != 0`. + +------------------------------------------------------------------- Old: ---- python-dunamai-1.19.2.tar.gz New: ---- python-dunamai-1.20.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-dunamai.spec ++++++ --- /var/tmp/diff_new_pack.LWXE8Z/_old 2024-04-21 20:29:11.294120721 +0200 +++ /var/tmp/diff_new_pack.LWXE8Z/_new 2024-04-21 20:29:11.294120721 +0200 @@ -18,7 +18,7 @@ %{?sle15_python_module_pythons} Name: python-dunamai -Version: 1.19.2 +Version: 1.20.0 Release: 0 Summary: Dynamic version generation License: MIT ++++++ python-dunamai-1.19.2.tar.gz -> python-dunamai-1.20.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dunamai-1.19.2/CHANGELOG.md new/dunamai-1.20.0/CHANGELOG.md --- old/dunamai-1.19.2/CHANGELOG.md 2024-02-16 20:50:40.460648500 +0100 +++ new/dunamai-1.20.0/CHANGELOG.md 2024-04-12 16:01:56.886240200 +0200 @@ -1,3 +1,10 @@ +## v1.20.0 (2024-04-12) + +* Updated `Version.bump()` to add a `smart` argument, + which only bumps when `distance != 0`. + This will also make `Version.serialize()` use pre-release formatting automatically, + like calling `Version.serialize(bump=True)`. + ## v1.19.2 (2024-02-16) * Fixed an exception when a Git repository had a broken ref. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dunamai-1.19.2/PKG-INFO new/dunamai-1.20.0/PKG-INFO --- old/dunamai-1.19.2/PKG-INFO 1970-01-01 01:00:00.000000000 +0100 +++ new/dunamai-1.20.0/PKG-INFO 1970-01-01 01:00:00.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: dunamai -Version: 1.19.2 +Version: 1.20.0 Summary: Dynamic version generation Home-page: https://github.com/mtkennerly/dunamai License: MIT diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dunamai-1.19.2/dunamai/__init__.py new/dunamai-1.20.0/dunamai/__init__.py --- old/dunamai-1.19.2/dunamai/__init__.py 2024-02-16 20:27:09.763793200 +0100 +++ new/dunamai-1.20.0/dunamai/__init__.py 2024-04-12 15:44:02.483939200 +0200 @@ -597,6 +597,7 @@ self._matched_tag = None # type: Optional[str] self._newer_unmatched_tags = None # type: Optional[Sequence[str]] + self._smart_bumped = False def __str__(self) -> str: return self.serialize() @@ -729,8 +730,8 @@ """ base = self.base revision = self.revision - if bump and self.distance > 0: - bumped = self.bump() + if bump: + bumped = self.bump(smart=True) base = bumped.base revision = bumped.revision @@ -782,7 +783,7 @@ if revision is not None: pre_parts.append(str(revision)) if self.distance > 0: - pre_parts.append("pre" if bump else "post") + pre_parts.append("pre" if bump or self._smart_bumped else "post") pre_parts.append(str(self.distance)) if style == Style.Pep440: @@ -796,7 +797,7 @@ stage = None dev = revision if self.distance > 0: - if bump: + if bump or self._smart_bumped: if dev is None: dev = self.distance else: @@ -914,7 +915,7 @@ epoch=epoch, ) - def bump(self, index: int = -1, increment: int = 1) -> "Version": + def bump(self, index: int = -1, increment: int = 1, smart: bool = False) -> "Version": """ Increment the version. @@ -927,9 +928,18 @@ the right side and count down from -1. Only has an effect when the base is bumped. :param increment: By how much to increment the relevant position. + :param smart: If true, only bump when distance is not 0. + This will also make `Version.serialize()` use pre-release formatting automatically, + like calling `Version.serialize(bump=True)`. :returns: Bumped version. """ bumped = copy.deepcopy(self) + + if smart: + if bumped.distance == 0: + return bumped + bumped._smart_bumped = True + if bumped.stage is None: bumped.base = bump_version(bumped.base, index, increment) else: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dunamai-1.19.2/pyproject.toml new/dunamai-1.20.0/pyproject.toml --- old/dunamai-1.19.2/pyproject.toml 2024-02-16 20:50:33.534545000 +0100 +++ new/dunamai-1.20.0/pyproject.toml 2024-04-12 16:01:47.254898000 +0200 @@ -1,6 +1,6 @@ [tool.poetry] name = "dunamai" -version = "1.19.2" +version = "1.20.0" description = "Dynamic version generation" license = "MIT" authors = ["Matthew T. Kennerly <mtkenne...@gmail.com>"] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dunamai-1.19.2/tests/unit/test_dunamai.py new/dunamai-1.20.0/tests/unit/test_dunamai.py --- old/dunamai-1.19.2/tests/unit/test_dunamai.py 2023-05-18 22:07:44.334564200 +0200 +++ new/dunamai-1.20.0/tests/unit/test_dunamai.py 2024-04-12 15:29:38.182111300 +0200 @@ -508,6 +508,14 @@ assert Version("1.2.3", stage=("a", None)).bump().serialize() == "1.2.3a2" assert Version("1.2.3", stage=("a", 4)).bump().serialize() == "1.2.3a5" + assert Version("1.2.3", distance=0).bump(smart=False).serialize() == "1.2.4" + assert Version("1.2.3", distance=0).bump(smart=True).serialize() == "1.2.3" + assert Version("1.2.3", distance=0).serialize(bump=True) == "1.2.3" + + assert Version("1.2.3", distance=5).bump(smart=False).serialize() == "1.2.4.post5.dev0" + assert Version("1.2.3", distance=5).bump(smart=True).serialize() == "1.2.4.dev5" + assert Version("1.2.3", distance=5).serialize(bump=True) == "1.2.4.dev5" + def test__version__parse(): assert Version.parse("1.2.3") == Version("1.2.3")