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


Python Git.shadowMerge方法代码示例

本文整理汇总了Python中git.Git.shadowMerge方法的典型用法代码示例。如果您正苦于以下问题:Python Git.shadowMerge方法的具体用法?Python Git.shadowMerge怎么用?Python Git.shadowMerge使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在git.Git的用法示例。


在下文中一共展示了Git.shadowMerge方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from git import Git [as 别名]
# 或者: from git.Git import shadowMerge [as 别名]

#.........这里部分代码省略.........
                print('push rejected, need to fetch')
                if self.fetch(remote):
                    continue
            elif stat == Git.UNKNOWN:
                self.perror('unknown error:\n' + msg.decode())
            elif stat == Git.SUCCESS:
                print('push done.')
                return True
            return False


    def preActionOfPushAndFetch(self, remote):
        """ Actions to carry out before push/fetch
        """
        if not self.git.shadowInit():
            return False
        if not self.git.setRemote(remote):
            return False
        return True


    def fetch(self, remote):
        """ Fetch from the git server
        """
        if not self.preActionOfPushAndFetch(remote):
            return False

        print('fetching...')
        stat, msg = self.git.shadowFetch(remote)
        if not stat:
            self.perror('fetch failed:\n' + msg.decode())
        else:
            print('merging...')
            stat, msg = self.git.shadowMerge(remote)
            if stat == Git.SUCCESS:
                print('fetch done.')
                return True
            elif stat == Git.UNKNOWN:
                self.perror('unknown error:\n' + msg.decode())
            elif stat == Git.CONFLICT:
                self.perror('automatic merge failed, fix the conflict, and retry')
        return False


    def recentLogs(self, count):
        """ Fetch the last 'count' logs that newly
        added or changed, use git for better speed.
        """
        return Record.engine.lastLogs(count)


    """ Methods defined below are Record definition specific,
    subclasses shall redefine/extend these methods according
    to the Record fields definition, or add more others.
    """

    def makeRequests(self, *, record=None, time=None, host=None,
            protocol=None, port=None, user=None, password=None, **junk):
        """ Create the necessary requests data for collecting
        information for a Record from the user interactively.
        """
        if record:      # a Record instance provided
            time      =  record.time
            host      =  record.host
            protocol  =  record.protocol
            port      =  record.port
开发者ID:iesugrace,项目名称:service-info-manager,代码行数:70,代码来源:log.py


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