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-08-08 10:57:27 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-dunamai (Old) and /work/SRC/openSUSE:Factory/.python-dunamai.new.7232 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "python-dunamai" Thu Aug 8 10:57:27 2024 rev:7 rq:1191994 version:1.22.0 Changes: -------- --- /work/SRC/openSUSE:Factory/python-dunamai/python-dunamai.changes 2024-06-28 15:50:33.605678899 +0200 +++ /work/SRC/openSUSE:Factory/.python-dunamai.new.7232/python-dunamai.changes 2024-08-08 10:58:02.318732792 +0200 @@ -1,0 +2,7 @@ +Wed Aug 7 04:35:52 UTC 2024 - Richard Rahl <rrahl0@opensuse.org> + +- update to 1.22.0: + * Fixed: The --ignore-untracked CLI flag was ignored. + * Added: --commit-length option. + +------------------------------------------------------------------- Old: ---- python-dunamai-1.21.2.tar.gz New: ---- python-dunamai-1.22.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-dunamai.spec ++++++ --- /var/tmp/diff_new_pack.c0luRr/_old 2024-08-08 10:58:02.726749566 +0200 +++ /var/tmp/diff_new_pack.c0luRr/_new 2024-08-08 10:58:02.730749731 +0200 @@ -18,7 +18,7 @@ %{?sle15_python_module_pythons} Name: python-dunamai -Version: 1.21.2 +Version: 1.22.0 Release: 0 Summary: Dynamic version generation License: MIT ++++++ python-dunamai-1.21.2.tar.gz -> python-dunamai-1.22.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dunamai-1.21.2/CHANGELOG.md new/dunamai-1.22.0/CHANGELOG.md --- old/dunamai-1.21.2/CHANGELOG.md 2024-06-27 05:58:28.811013500 +0200 +++ new/dunamai-1.22.0/CHANGELOG.md 2024-08-07 06:06:30.178075800 +0200 @@ -1,3 +1,8 @@ +## v1.22.0 (2024-08-07) + +* Fixed: The `--ignore-untracked` CLI flag was ignored. +* Added: `--commit-length` option. + ## v1.21.2 (2024-06-26) * Fixed: Some timestamps could fail to parse on Python 3.5 and 3.6. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dunamai-1.21.2/PKG-INFO new/dunamai-1.22.0/PKG-INFO --- old/dunamai-1.21.2/PKG-INFO 1970-01-01 01:00:00.000000000 +0100 +++ new/dunamai-1.22.0/PKG-INFO 1970-01-01 01:00:00.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: dunamai -Version: 1.21.2 +Version: 1.22.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.21.2/dunamai/__init__.py new/dunamai-1.22.0/dunamai/__init__.py --- old/dunamai-1.21.2/dunamai/__init__.py 2024-06-27 05:28:41.888780600 +0200 +++ new/dunamai-1.22.0/dunamai/__init__.py 2024-08-07 05:52:07.056821300 +0200 @@ -986,6 +986,7 @@ path: Optional[Path] = None, pattern_prefix: Optional[str] = None, ignore_untracked: bool = False, + commit_length: Optional[int] = None, ) -> "Version": r""" Determine a version based on Git tags. @@ -1004,9 +1005,12 @@ :param pattern_prefix: Insert this after the pattern's start anchor (`^`). :param ignore_untracked: Ignore untracked files when determining whether the repository is dirty. + :param commit_length: + Use this many characters from the start of the full commit hash. :returns: Detected version. """ vcs = Vcs.Git + full_commit = full_commit or commit_length is not None archival = _find_higher_file(".git_archival.json", path, ".git") if archival is not None: @@ -1019,6 +1023,9 @@ else: commit = data.get("hash-short") + if commit is not None: + commit = commit[:commit_length] + timestamp = None raw_timestamp = data.get("timestamp") if raw_timestamp: @@ -1118,7 +1125,7 @@ ) if code == 128: return cls._fallback(strict, distance=0, dirty=True, branch=branch, concerns=concerns, vcs=vcs) - commit = msg + commit = msg[:commit_length] timestamp = None if git_version < [2, 2]: @@ -1243,6 +1250,7 @@ strict: bool = False, path: Optional[Path] = None, pattern_prefix: Optional[str] = None, + commit_length: Optional[int] = None, ) -> "Version": r""" Determine a version based on Mercurial tags. @@ -1257,9 +1265,12 @@ When there are no tags, fail instead of falling back to 0.0.0. :param path: Directory to inspect, if not the current working directory. :param pattern_prefix: Insert this after the pattern's start anchor (`^`). + :param commit_length: + Use this many characters from the start of the full commit hash. :returns: Detected version. """ vcs = Vcs.Mercurial + full_commit = full_commit or commit_length is not None archival = _find_higher_file(".hg_archival.txt", path, ".hg") if archival is not None: @@ -1275,6 +1286,8 @@ # The distance is 1 on a new repo or on a tagged commit. distance = int(data.get("latesttagdistance", 1)) - 1 commit = data.get("node") + if commit is not None: + commit = commit[:commit_length] branch = data.get("branch") if tag is None or tag == "null": @@ -1326,7 +1339,7 @@ branch = msg code, msg = _run_cmd('hg id --template "{}"'.format("{id}" if full_commit else "{id|short}"), path) - commit = msg if set(msg) != {"0"} else None + commit = msg[:commit_length] if set(msg) != {"0"} else None code, msg = _run_cmd('hg log --limit 1 --template "{date|rfc3339date}"', path) timestamp = _parse_git_timestamp_iso_strict(msg) if msg != "" else None @@ -1395,6 +1408,7 @@ strict: bool = False, path: Optional[Path] = None, pattern_prefix: Optional[str] = None, + commit_length: Optional[int] = None, ) -> "Version": r""" Determine a version based on Darcs tags. @@ -1408,6 +1422,8 @@ When there are no tags, fail instead of falling back to 0.0.0. :param path: Directory to inspect, if not the current working directory. :param pattern_prefix: Insert this after the pattern's start anchor (`^`). + :param commit_length: + Use this many characters from the start of the full commit hash. :returns: Detected version. """ vcs = Vcs.Darcs @@ -1423,6 +1439,8 @@ timestamp = None else: commit = root[0].attrib["hash"] + if commit is not None: + commit = commit[:commit_length] timestamp = dt.datetime.strptime(root[0].attrib["date"] + "+0000", "%Y%m%d%H%M%S%z") code, msg = _run_cmd("darcs show tags", path) @@ -1475,6 +1493,7 @@ strict: bool = False, path: Optional[Path] = None, pattern_prefix: Optional[str] = None, + commit_length: Optional[int] = None, ) -> "Version": r""" Determine a version based on Subversion tags. @@ -1489,6 +1508,8 @@ When there are no tags, fail instead of falling back to 0.0.0. :param path: Directory to inspect, if not the current working directory. :param pattern_prefix: Insert this after the pattern's start anchor (`^`). + :param commit_length: + Use this many characters from the start of the full commit hash. :returns: Detected version. """ vcs = Vcs.Subversion @@ -1506,7 +1527,7 @@ if not msg or msg == "0": commit = None else: - commit = msg + commit = msg[:commit_length] timestamp = None if commit: @@ -1573,6 +1594,7 @@ strict: bool = False, path: Optional[Path] = None, pattern_prefix: Optional[str] = None, + commit_length: Optional[int] = None, ) -> "Version": r""" Determine a version based on Bazaar tags. @@ -1586,6 +1608,8 @@ When there are no tags, fail instead of falling back to 0.0.0. :param path: Directory to inspect, if not the current working directory. :param pattern_prefix: Insert this after the pattern's start anchor (`^`). + :param commit_length: + Use this many characters from the start of the full commit hash. :returns: Detected version. """ vcs = Vcs.Bazaar @@ -1601,7 +1625,7 @@ for line in msg.splitlines(): info = line.split("revno: ", maxsplit=1) if len(info) == 2: - commit = info[1] + commit = info[1][:commit_length] info = line.split("branch nick: ", maxsplit=1) if len(info) == 2: @@ -1668,6 +1692,7 @@ strict: bool = False, path: Optional[Path] = None, pattern_prefix: Optional[str] = None, + commit_length: Optional[int] = None, ) -> "Version": r""" Determine a version based on Fossil tags. @@ -1680,6 +1705,8 @@ When there are no tags, fail instead of falling back to 0.0.0. :param path: Directory to inspect, if not the current working directory. :param pattern_prefix: Insert this after the pattern's start anchor (`^`). + :param commit_length: + Use this many characters from the start of the full commit hash. :returns: Detected version. """ vcs = Vcs.Fossil @@ -1692,7 +1719,7 @@ branch = msg code, msg = _run_cmd("fossil sql \"SELECT value FROM vvar WHERE name = 'checkout-hash' LIMIT 1\"", path) - commit = msg.strip("'") + commit = msg.strip("'")[:commit_length] code, msg = _run_cmd( 'fossil sql "' @@ -1802,6 +1829,7 @@ strict: bool = False, path: Optional[Path] = None, pattern_prefix: Optional[str] = None, + commit_length: Optional[int] = None, ) -> "Version": r""" Determine a version based on Pijul tags. @@ -1815,6 +1843,8 @@ When there are no tags, fail instead of falling back to 0.0.0. :param path: Directory to inspect, if not the current working directory. :param pattern_prefix: Insert this after the pattern's start anchor (`^`). + :param commit_length: + Use this many characters from the start of the full commit hash. :returns: Detected version. """ vcs = Vcs.Pijul @@ -1835,7 +1865,7 @@ if len(limited_commits) == 0: return cls._fallback(strict, dirty=dirty, branch=branch, vcs=vcs) - commit = limited_commits[0]["hash"] + commit = limited_commits[0]["hash"][:commit_length] timestamp = _parse_timestamp(limited_commits[0]["timestamp"]) code, msg = _run_cmd("pijul log --output-format json", path) @@ -1951,6 +1981,7 @@ path: Optional[Path] = None, pattern_prefix: Optional[str] = None, ignore_untracked: bool = False, + commit_length: Optional[int] = None, ) -> "Version": r""" Determine a version based on a detected version control system. @@ -1983,6 +2014,8 @@ :param ignore_untracked: Ignore untracked files when determining whether the repository is dirty. This is only used for Git currently. + :param commit_length: + Use this many characters from the start of the full commit hash. :returns: Detected version. """ vcs = _detect_vcs_from_archival(path) @@ -1999,6 +2032,7 @@ path, pattern_prefix, ignore_untracked, + commit_length, ) @classmethod @@ -2014,6 +2048,7 @@ path: Optional[Path] = None, pattern_prefix: Optional[str] = None, ignore_untracked: bool = False, + commit_length: Optional[int] = None, ) -> "Version": r""" Determine a version based on a specific VCS setting. @@ -2040,6 +2075,8 @@ :param ignore_untracked: Ignore untracked files when determining whether the repository is dirty. This is only used for Git currently. + :param commit_length: + Use this many characters from the start of the full commit hash. :returns: Detected version. """ return cls._do_vcs_callback( @@ -2053,6 +2090,7 @@ path, pattern_prefix, ignore_untracked, + commit_length, ) @classmethod @@ -2068,6 +2106,7 @@ path: Optional[Path], pattern_prefix: Optional[str] = None, ignore_untracked: bool = False, + commit_length: Optional[int] = None, ) -> "Version": mapping = { Vcs.Any: cls.from_any_vcs, @@ -2091,6 +2130,7 @@ ("path", path), ("pattern_prefix", pattern_prefix), ("ignore_untracked", ignore_untracked), + ("commit_length", commit_length), ]: if kwarg in inspect.getfullargspec(callback).args: kwargs[kwarg] = value diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dunamai-1.21.2/dunamai/__main__.py new/dunamai-1.22.0/dunamai/__main__.py --- old/dunamai-1.21.2/dunamai/__main__.py 2024-06-27 04:59:56.764542800 +0200 +++ new/dunamai-1.22.0/dunamai/__main__.py 2024-08-07 05:54:37.013108700 +0200 @@ -125,6 +125,12 @@ "help": "Get the full commit hash instead of the short form", }, { + "triggers": ["--commit-length"], + "dest": "commit_length", + "type": int, + "help": "Use this many characters from the start of the full commit hash", + }, + { "vcs": [Vcs.Git], "triggers": ["--tag-branch"], "help": "Branch on which to find tags, if different than the current branch", @@ -234,8 +240,12 @@ return parser +def get_parser() -> argparse.ArgumentParser: + return build_parser(cli_spec) + + def parse_args(argv=None) -> argparse.Namespace: - return build_parser(cli_spec).parse_args(argv) + return get_parser().parse_args(argv) def from_stdin(value: Optional[str]) -> Optional[str]: @@ -265,8 +275,22 @@ strict: bool, path: Optional[Path], pattern_prefix: Optional[str], + ignore_untracked: bool, + commit_length: Optional[int], ) -> None: - version = Version.from_vcs(vcs, pattern, latest_tag, tag_dir, tag_branch, full_commit, strict, path, pattern_prefix) + version = Version.from_vcs( + vcs, + pattern, + latest_tag, + tag_dir, + tag_branch, + full_commit, + strict, + path, + pattern_prefix, + ignore_untracked, + commit_length, + ) for concern in version.concerns: print("Warning: {}".format(concern.message()), file=sys.stderr) @@ -285,6 +309,8 @@ tag_dir = getattr(args, "tag_dir", "tags") tag_branch = getattr(args, "tag_branch", None) full_commit = getattr(args, "full_commit", False) + ignore_untracked = getattr(args, "ignore_untracked", False) + commit_length = getattr(args, "commit_length", None) from_vcs( Vcs(args.vcs), args.pattern, @@ -302,6 +328,8 @@ args.strict, Path(args.path) if args.path is not None else None, args.pattern_prefix, + ignore_untracked, + commit_length, ) elif args.command == "check": version = from_stdin(args.version) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dunamai-1.21.2/pyproject.toml new/dunamai-1.22.0/pyproject.toml --- old/dunamai-1.21.2/pyproject.toml 2024-06-27 05:57:05.618044400 +0200 +++ new/dunamai-1.22.0/pyproject.toml 2024-08-07 06:06:34.420952000 +0200 @@ -1,6 +1,6 @@ [tool.poetry] name = "dunamai" -version = "1.21.2" +version = "1.22.0" description = "Dynamic version generation" license = "MIT" authors = ["Matthew T. Kennerly <mtkennerly@gmail.com>"] @@ -38,6 +38,7 @@ black = { version = "22.1.0", python = "^3.7" } mypy = { version = "^0.982", python = "^3.7" } ruff = {version = "^0.0.272", python = "^3.7"} +argparse-manpage = {version = "^4.6", python = ">=3.7"} [tool.poetry.scripts] dunamai = 'dunamai.__main__:main' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dunamai-1.21.2/tests/unit/test_main.py new/dunamai-1.22.0/tests/unit/test_main.py --- old/dunamai-1.21.2/tests/unit/test_main.py 2024-06-27 04:59:56.723363400 +0200 +++ new/dunamai-1.22.0/tests/unit/test_main.py 2024-08-07 05:59:38.481182300 +0200 @@ -26,6 +26,7 @@ path=None, pattern_prefix=None, ignore_untracked=False, + commit_length=None, ) assert parse_args(["from", "git"]).vcs == "git" assert parse_args(["from", "git", "--tag-branch", "foo"]).tag_branch == "foo" @@ -55,6 +56,7 @@ assert parse_args(["from", "any", "--path", "/tmp"]).path == "/tmp" assert parse_args(["from", "any", "--pattern-prefix", "foo-"]).pattern_prefix == "foo-" assert parse_args(["from", "any", "--ignore-untracked"]).ignore_untracked is True + assert parse_args(["from", "any", "--commit-length", "10"]).commit_length == 10 assert parse_args(["from", "subversion", "--tag-dir", "foo"]).tag_dir == "foo" with pytest.raises(SystemExit):