git_well.git_branch_upgrade module

A git tool for handling the dev/<version> branch patterns

See the GitDevbranchConfig for functionality

Notes

to remove branches from remotes

f”git push origin –delete {branch_name}”

to see results:

git fetch –prune

Requires:

scriptconfig git-python packaging ubelt

class git_well.git_branch_upgrade.UpdateDevBranch(*args: Any, **kwargs: Any)[source]

Bases: DataConfig

Upgrade to the latest “dev” branch. I.e. search for the branch dev/<version> with the greatest semantic version.

Valid options: []

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

  • **kwargs – keyword arguments for this data config

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

Example

>>> from git_well.git_branch_upgrade import UpdateDevBranch
>>> from git_well.repo import Repo
>>> cls = UpdateDevBranch
>>> repo = Repo.demo()
>>> 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
>>> cls.main(argv=argv, **kwargs)
>>> assert repo.active_branch.name == 'dev/2.1.0'
default = {'repo_dpath': <Value('.')>}
git_well.git_branch_upgrade.dev_branches(repo: Any) list[dict[str, Any]][source]
git_well.git_branch_upgrade.main(argv: list[str] | str | bool | None = True, **kwargs: Any) None

Example

>>> from git_well.git_branch_upgrade import UpdateDevBranch
>>> from git_well.repo import Repo
>>> cls = UpdateDevBranch
>>> repo = Repo.demo()
>>> 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
>>> cls.main(argv=argv, **kwargs)
>>> assert repo.active_branch.name == 'dev/2.1.0'