diff --git a/CHANGELOG.md b/CHANGELOG.md index 93ac089..ae591fb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## [0.4.1] - 2025-12-08 + +* Add branch close subcommand and integrate release close/editor flow (ChatGPT: https://chatgpt.com/share/69374f09-c760-800f-92e4-5b44a4510b62) + + ## [0.4.0] - 2025-12-08 * Add branch closing helper and --close flag to release command, including CLI wiring and tests (see https://chatgpt.com/share/69374aec-74ec-800f-bde3-5d91dfdb9b91) diff --git a/PKGBUILD b/PKGBUILD index 6581360..faefd36 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -1,7 +1,7 @@ # Maintainer: Kevin Veen-Birkenbach pkgname=package-manager -pkgver=0.4.0 +pkgver=0.4.1 pkgrel=1 pkgdesc="Local-flake wrapper for Kevin's package-manager (Nix-based)." arch=('any') diff --git a/debian/changelog b/debian/changelog index e2e22c7..9520fb0 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +package-manager (0.4.1-1) unstable; urgency=medium + + * Add branch close subcommand and integrate release close/editor flow (ChatGPT: https://chatgpt.com/share/69374f09-c760-800f-92e4-5b44a4510b62) + + -- Kevin Veen-Birkenbach Mon, 08 Dec 2025 23:20:28 +0100 + package-manager (0.4.0-1) unstable; urgency=medium * Add branch closing helper and --close flag to release command, including CLI wiring and tests (see https://chatgpt.com/share/69374aec-74ec-800f-bde3-5d91dfdb9b91) diff --git a/flake.nix b/flake.nix index 67a19a8..70d01cc 100644 --- a/flake.nix +++ b/flake.nix @@ -31,7 +31,7 @@ rec { pkgmgr = pyPkgs.buildPythonApplication { pname = "package-manager"; - version = "0.4.0"; + version = "0.4.1"; # Use the git repo as source src = ./.; diff --git a/package-manager.spec b/package-manager.spec index 2dcdfd8..4e42e67 100644 --- a/package-manager.spec +++ b/package-manager.spec @@ -1,5 +1,5 @@ Name: package-manager -Version: 0.4.0 +Version: 0.4.1 Release: 1%{?dist} Summary: Wrapper that runs Kevin's package-manager via Nix flake diff --git a/pkgmgr/branch_commands.py b/pkgmgr/branch_commands.py index 2b9657f..d0fe43c 100644 --- a/pkgmgr/branch_commands.py +++ b/pkgmgr/branch_commands.py @@ -1,3 +1,4 @@ +# pkgmgr/branch_commands.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- diff --git a/pkgmgr/cli_core/commands/branch.py b/pkgmgr/cli_core/commands/branch.py index 4d95e96..ed0a1d3 100644 --- a/pkgmgr/cli_core/commands/branch.py +++ b/pkgmgr/cli_core/commands/branch.py @@ -1,9 +1,10 @@ +# pkgmgr/cli_core/commands/branch.py from __future__ import annotations import sys from pkgmgr.cli_core.context import CLIContext -from pkgmgr.branch_commands import open_branch +from pkgmgr.branch_commands import open_branch, close_branch def handle_branch(args, ctx: CLIContext) -> None: @@ -11,7 +12,8 @@ def handle_branch(args, ctx: CLIContext) -> None: Handle `pkgmgr branch` subcommands. Currently supported: - - pkgmgr branch open [] [--base ] + - pkgmgr branch open [] [--base ] + - pkgmgr branch close [] [--base ] """ if args.subcommand == "open": open_branch( @@ -21,5 +23,13 @@ def handle_branch(args, ctx: CLIContext) -> None: ) return + if args.subcommand == "close": + close_branch( + name=getattr(args, "name", None), + base_branch=getattr(args, "base", "main"), + cwd=".", + ) + return + print(f"Unknown branch subcommand: {args.subcommand}") sys.exit(2) diff --git a/pkgmgr/release.py b/pkgmgr/release.py index 2a00c3c..ed80de4 100644 --- a/pkgmgr/release.py +++ b/pkgmgr/release.py @@ -1,3 +1,4 @@ +# pkgmgr/release.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- @@ -151,8 +152,14 @@ def _open_editor_for_changelog(initial_message: Optional[str] = None) -> str: tmp.write(initial_message.strip() + "\n") tmp.flush() - # Open editor - subprocess.call([editor, tmp_path]) + # Open editor (best-effort; fall back gracefully if not available) + try: + subprocess.call([editor, tmp_path]) + except FileNotFoundError: + print( + f"[WARN] Editor {editor!r} not found; proceeding without " + "interactive changelog message." + ) # Read back content try: @@ -651,8 +658,8 @@ def _release_impl( # 2) Update files. update_pyproject_version(pyproject_path, new_ver_str, preview=preview) - # Let update_changelog resolve or edit the message; reuse it for debian. - message = update_changelog( + # Let update_changelog resolve or edit the message; capture it separately. + changelog_message = update_changelog( changelog_path, new_ver_str, message=message, @@ -669,6 +676,12 @@ def _release_impl( spec_path = os.path.join(repo_root, "package-manager.spec") update_spec_version(spec_path, new_ver_str, preview=preview) + # Determine an effective message for tag & Debian changelog. + effective_message: Optional[str] = message + if effective_message is None and isinstance(changelog_message, str): + if changelog_message.strip(): + effective_message = changelog_message.strip() + debian_changelog_path = os.path.join(repo_root, "debian", "changelog") # Use repo directory name as a simple default for package name package_name = os.path.basename(repo_root) or "package-manager" @@ -676,13 +689,13 @@ def _release_impl( debian_changelog_path, package_name=package_name, new_version=new_ver_str, - message=message, + message=effective_message, preview=preview, ) # 3) Git operations: stage, commit, tag, push. commit_msg = f"Release version {new_ver_str}" - tag_msg = message or commit_msg + tag_msg = effective_message or commit_msg try: branch = get_current_branch() or "main" diff --git a/pyproject.toml b/pyproject.toml index a05ee07..abf7aa1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,7 +7,7 @@ build-backend = "setuptools.build_meta" [project] name = "package-manager" -version = "0.4.0" +version = "0.4.1" description = "Kevin's package-manager tool (pkgmgr)" readme = "README.md" requires-python = ">=3.11"