rlsbl v0.113.0 /rlsbl.prepush_utils
On this page

Pre-push check utilities for commit enumeration and JSONL changelog coverage verification, shared across the prepush and workspace checks.

#rlsbl.prepush_utils

#rlsbl.prepush_utils

Pre-push check utilities shared between checks/prepush.py and checks/workspace.py, providing commit enumeration and JSONL coverage verification.

Extracted from commands/pre_push_check.py to break the checks/ -> commands/ circular dependency. The original module existed solely to host these functions after the pre-push-check CLI command was removed.

#_get_release_branches

python
def _get_release_branches(ctx)

Return the configured release-branch list.

Reads release_branches from .rlsbl/config.json if present; falls back to ["main", "master"] when the key is absent.

Branch-role semantics:

  • Branches in this list are release-only: manual pushes

trigger a warning (prepush-manual-warning), and rlsbl release run targets them as the release branch.

  • Everything else is a shareable (dev) branch: sessions push

freely; rlsbl release run from a dev branch fast-forward merges into the first release branch before releasing.

Changelog coverage (prepush-changelog-coverage) is enforced on every push regardless of target branch -- dev branches are not exempt.

In monorepos the dev branch is workspace-global (no per-project dev branches).

Raises :class:ConfigError if the key is present but malformed (empty list or non-list value). An empty list would silently disable the manual-release-push warning, which is almost never what the user wants; require explicit removal of the key instead.

#_check_gitignore_guard

python
def _check_gitignore_guard(dir_path, *, extra_paths=None)

Check that rlsbl-managed files are not gitignored.

When extra_paths is provided, those paths are also checked (e.g., releasable-level changes files in explicit monorepo mode).

Returns an error string listing gitignored paths, or None if all clear.

#_check_jsonl_changelog

python
def _check_jsonl_changelog(dir_path, refs, pushed_commits=None, *, changes_dir=None)

Check JSONL changelog coverage for commits being pushed.

Verifies that every commit in the push range exists in at least one unreleased.jsonl entry's commits list.

When pushed_commits is provided, uses that set directly instead of calling _get_pushed_commits(refs). This allows callers (e.g. monorepo check) to pass a pre-filtered set of commits.

When changes_dir is provided, uses that directory instead of computing it from dir_path. This supports explicit releasable mode where the changes directory lives at the releasable level, not per-project.

Returns None on success, or an error message string on failure.

#_get_pushed_commits

python
def _get_pushed_commits(refs)

Get the set of commit SHAs being pushed.

Returns a set of full 40-char SHAs, or None on error.

#_read_stdin_lines

python
def _read_stdin_lines()

Read raw pre-push hook stdin lines.

Returns a list of non-empty lines, or None if stdin is not readable or empty.

#_parse_stdin_refs

python
def _parse_stdin_refs(stdin_lines=None)

Parse pre-push hook stdin to extract (local_sha, remote_sha) pairs.

Each line is:

When stdin_lines is provided (a list of raw lines), parses those directly instead of reading stdin. When omitted, reads stdin via _read_stdin_lines().

Returns a list of (local_sha, remote_sha) tuples, or None if the input is empty or unreadable.

Search