git_well.git_branch_cleanup module

class git_well.git_branch_cleanup.CleanDevBranchConfig(*args: Any, **kwargs: Any)[source]

Bases: DataConfig

Cleanup branches that have been merged into main.

Valid options: []

Parameters:
  • *args – positional arguments for this data config

  • **kwargs – keyword arguments for this data config

repo_dpath: Value
keep_last: Value
remove_merged: Value
yes: Value
classmethod main(argv: list[str] | str | bool | None = True, **kwargs: Any) None[source]

Example

>>> from git_well.git_branch_cleanup import CleanDevBranchConfig
>>> from git_well.repo import Repo
>>> cls = CleanDevBranchConfig
>>> repo = Repo.demo()
>>> # TODO: add commits so they aren't all considerd the same branch
>>> repo.cmd('git checkout -b dev/1.0.0')
>>> repo.cmd('git checkout -b dev/2.1.0')
>>> repo.cmd('git checkout main')
>>> assert repo.active_branch.name == 'main'
>>> argv = False
>>> kwargs = dict()
>>> kwargs['repo_dpath'] = repo
>>> kwargs['yes'] = True
>>> cls.main(argv=argv, **kwargs)
default = {'keep_last': <Value(1)>, 'remove_merged': <Value(False)>, 'repo_dpath': <Value('.')>, 'yes': <Value(False)>}
git_well.git_branch_cleanup.main(argv: list[str] | str | bool | None = True, **kwargs: Any) None

Example

>>> from git_well.git_branch_cleanup import CleanDevBranchConfig
>>> from git_well.repo import Repo
>>> cls = CleanDevBranchConfig
>>> repo = Repo.demo()
>>> # TODO: add commits so they aren't all considerd the same branch
>>> repo.cmd('git checkout -b dev/1.0.0')
>>> repo.cmd('git checkout -b dev/2.1.0')
>>> repo.cmd('git checkout main')
>>> assert repo.active_branch.name == 'main'
>>> argv = False
>>> kwargs = dict()
>>> kwargs['repo_dpath'] = repo
>>> kwargs['yes'] = True
>>> cls.main(argv=argv, **kwargs)