本文整理汇总了Python中git.Git.rebase方法的典型用法代码示例。如果您正苦于以下问题:Python Git.rebase方法的具体用法?Python Git.rebase怎么用?Python Git.rebase使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类git.Git
的用法示例。
在下文中一共展示了Git.rebase方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: GitFlow
# 需要导入模块: from git import Git [as 别名]
# 或者: from git.Git import rebase [as 别名]
#.........这里部分代码省略.........
@requires_initialized
def tag(self, tagname, commit, message=None, sign=False, signingkey=None):
kwargs = {}
if sign:
kwargs['s'] = True
if signingkey:
kwargs['u'] = signingkey
self.repo.create_tag(tagname, commit, message=message or None, **kwargs)
#
# ====== sub commands =====
#
@requires_repo
def list(self, identifier, arg0_name, verbose, use_tagname):
"""
List the all branches of the given type. If there are not
branches of this type, raises :exc:`Usage` with an
explanation on how to start a branch of this type.
:param identifier:
The identifier for the type of branch to work on.
A :class:`BranchManager <git.branches.BranchManager>` for the given
identifier must exist in the :attr:`self.managers`.
:param arg0_name:
Name of the first argument for the command line to be put
into the explanation on how to start a branch of this
type. This typically is `name` or `version`.
:param verbose:
If True, give more information about the state of the
branch: Whether it's ahead or behind it's default base,
may be rebased, etc.
:param use_tagname:
If True, try to describe the state based on the next tag.
"""
repo = self.repo
manager = self.managers[identifier]
branches = manager.list()
if not branches:
raise Usage(
'No %s branches exist.' % identifier,
'You can start a new %s branch with the command:' % identifier,
' git flow %s start <%s> [<base>]' % (identifier, arg0_name)
)
# determine the longest branch name
width = max(len(b.name) for b in branches) - len(manager.prefix) + 1
basebranch_sha = repo.branches[manager.default_base()].commit.hexsha
for branch in branches:
if repo.active_branch == branch:
prefix = '* '
else:
prefix = ' '
name = manager.shorten(branch.name)
extra_info = ''
if verbose:
name = name.ljust(width)
branch_sha = branch.commit.hexsha
base_sha = repo.git.merge_base(basebranch_sha, branch_sha)