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, **kwargs)[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
- classmethod main(cmdline=1, **kwargs)[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' >>> cmdline = 0 >>> kwargs = dict() >>> kwargs['repo_dpath'] = repo >>> cls.main(cmdline=cmdline, **kwargs) >>> assert repo.active_branch.name == 'dev/2.1.0'
- default = {'repo_dpath': <Value('.')>}¶
- git_well.git_branch_upgrade.main(cmdline=1, **kwargs)¶
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' >>> cmdline = 0 >>> kwargs = dict() >>> kwargs['repo_dpath'] = repo >>> cls.main(cmdline=cmdline, **kwargs) >>> assert repo.active_branch.name == 'dev/2.1.0'