Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
# fmt: on
git_bumper = GitBumper(working_path)
git_bumper.set_config(config)
git_state_error = None
try:
git_bumper.check_dirty() # Avoid data loss
if not only_patch:
git_bumper.check_branch_state(new_version)
except tbump.git.GitError as e:
if dry_run:
git_state_error = e
else:
raise
file_bumper = FileBumper(working_path)
file_bumper.set_config(config)
hooks_runner = HooksRunner(working_path, config.current_version)
if not only_patch:
for hook in config.hooks:
hooks_runner.add_hook(hook)
executor = Executor(new_version, file_bumper)
if not only_patch:
executor.add_git_and_hook_actions(new_version, git_bumper, hooks_runner)
if interactive:
executor.print_self(dry_run=True)
if not dry_run:
proceed = ui.ask_yes_no("Looking good?", default=False)
if not proceed:
def bump_files(new_version: str, repo_path: Path = None) -> None:
repo_path = repo_path or Path(".")
bumper = FileBumper(repo_path)
cfg = tbump.config.parse(repo_path / "tbump.toml")
bumper.set_config(cfg)
patches = bumper.get_patches(new_version=new_version)
n = len(patches)
for i, patch in enumerate(patches):
ui.info_count(i, n, patch.src)
patch.print_self()
patch.apply()