Coverage for src/hatch_ci/script.py : 86%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
"""create a beta branch or release a beta branch
This script will either create a new beta branch:
hatch-ci make-beta ./src/package_name/__init__.py
Or will release the beta branch and will move inot the next minor
hatch-ci {major|minor|micro} ./src/package_name/__init__.py
"""
"-w", "--workdir", help="git working dir", default=Path("."), type=Path, )
options: argparse.Namespace, error: cli.ErrorFn ) -> argparse.Namespace: "no git directory", "It looks the repository is not a git repo", hint="init the git directory", ) log.info("current branch set to '%s'", branch) "invalid git repository", """ It looks the repository doesn't have any branch, you should: git checkout --orphan <branch-name> """, hint="create a git branch", ) return options
# master branch options.repo.config["init.defaultbranch"] if "init.defaultbranch" in options.repo.config else "master" )
options.error(f"modified files in {options.repo.workdir}")
raise tools.InvalidVersionError(f"cannot find a version in {options.initfile}")
# fetching all remotes
options.error( f"wrong branch '{options.repo.head.name}', expected '{master}'" )
tools.indent( f""" The release branch beta/{version} has been created.
To complete the release: git push origin beta/{version}
To revert this beta branch: git branch -D beta/{version} """ ), file=sys.stderr, ) # we need to be in the beta/N.M.O branch f"wrong branch '{options.repo.head.shorthand}'", f"expected to be in 'beta/{version}' branch", f"git checkout beta/{version}", ) return options.error(f"wrong version file {version=} != {local}")
# create an empty commit to mark the release
# tag
# switch to master (and incorporate the commit message)
# bump version
# commit options.initfile, f"version bump {version} -> {new_version}" )
tools.indent( f""" The release is almost complete.
To complete the release: git push origin release/{version} git push origin master
To revert this release: git reset --hard HEAD~1 git tag -d release/{version} """ ), file=sys.stderr, ) else: options.error(f"unsupported mode {options.mode=}") raise RuntimeError(f"unsupported mode {options.mode=}")
main() |