当前位置: 首页>>代码示例>>Python>>正文


Python Git.rebase方法代码示例

本文整理汇总了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)
开发者ID:chassing,项目名称:gitflow,代码行数:70,代码来源:core.py


注:本文中的git.Git.rebase方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。