git_well.git_branch_cleanup module

class git_well.git_branch_cleanup.CleanDevBranchConfig(*args, **kwargs)[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

classmethod main(cmdline=1, **kwargs)[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'
>>> cmdline = 0
>>> kwargs = dict()
>>> kwargs['repo_dpath'] = repo
>>> kwargs['yes'] = True
>>> cls.main(cmdline=cmdline, **kwargs)
default = {'keep_last': <Value(1)>, 'remove_merged': <Value(False)>, 'repo_dpath': <Value('.')>, 'yes': <Value(False)>}
git_well.git_branch_cleanup.main(cmdline=1, **kwargs)

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'
>>> cmdline = 0
>>> kwargs = dict()
>>> kwargs['repo_dpath'] = repo
>>> kwargs['yes'] = True
>>> cls.main(cmdline=cmdline, **kwargs)