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


Python Repo.description方法代码示例

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


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

示例1: set_repo_params

# 需要导入模块: from git import Repo [as 别名]
# 或者: from git.Repo import description [as 别名]
def set_repo_params(toplevel, gitdir, owner, description, reference):
    if owner is None and description is None:
        # Let the default git values be there, then
        return

    fullpath = os.path.join(toplevel, gitdir.lstrip('/'))
    repo = Repo(fullpath)

    if description is not None and repo.description != description:
        logger.debug('Setting %s description to: %s' % (gitdir, description))
        repo.description = description

    if owner is not None:
        logger.debug('Setting %s owner to: %s' % (gitdir, owner))
        repo.git.config('gitweb.owner', owner)

    if reference is not None:
        # XXX: Removing alternates involves git repack, so we don't support it
        #      at this point. We also cowardly refuse to change an existing
        #      alternates entry, as this has high chance of resulting in
        #      broken git repositories. Only do this when we're going from
        #      none to some value.
        if len(repo.alternates) > 0:
            return

        objects = os.path.join(toplevel, reference.lstrip('/'), 'objects')
        altfile = os.path.join(fullpath, 'objects', 'info', 'alternates')
        logger.debug('Setting %s alternates to: %s' % (gitdir, objects))
        altfh = open(altfile, 'w')
        altfh.write('%s\n' % objects)
        altfh.close()
开发者ID:edmonds,项目名称:grokmirror,代码行数:33,代码来源:pull.py

示例2: set_repo_params

# 需要导入模块: from git import Repo [as 别名]
# 或者: from git.Repo import description [as 别名]
def set_repo_params(toplevel, gitdir, owner, description, reference):
    if owner is None and description is None and reference is None:
        # Let the default git values be there, then
        return

    fullpath = os.path.join(toplevel, gitdir.lstrip('/'))
    repo = Repo(fullpath)

    # Make sure the repo is set as gc.auto=0, because running auto-gc
    # on a repo that has alternates to other repos can result in
    # corruption. We run our own gc inside the grok-fsck process that
    # is aware of alternates and won't blow things up.
    repo.git.config('gc.auto', '0')

    if description is not None:
        try:
            if repo.description != description:
                logger.debug('Setting %s description to: %s',
                             gitdir, description)
                repo.description = description
        except IOError:
            # Bug in git-python will throw an exception if description
            # file is not found
            logger.debug('%s description file missing, setting to: %s',
                         gitdir, description)
            repo.description = description

    if owner is not None:
        logger.debug('Setting %s owner to: %s', gitdir, owner)
        repo.git.config('gitweb.owner', owner)

    if reference is not None:
        # XXX: Removing alternates involves git repack, so we don't support it
        #      at this point. We also cowardly refuse to change an existing
        #      alternates entry, as this has high chance of resulting in
        #      broken git repositories. Only do this when we're going from
        #      none to some value.
        if len(repo.alternates) > 0:
            return

        objects = os.path.join(toplevel, reference.lstrip('/'), 'objects')
        altfile = os.path.join(fullpath, 'objects', 'info', 'alternates')
        logger.info('Setting %s alternates to: %s', gitdir, objects)
        with open(altfile, 'wt') as altfh:
            altfh.write('%s\n' % objects)
开发者ID:mricon,项目名称:grokmirror,代码行数:47,代码来源:pull.py


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