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


Python Git.is_cygwin方法代码示例

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


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

示例1: test_git_work_tree_dotgit

# 需要导入模块: from git import Git [as 别名]
# 或者: from git.Git import is_cygwin [as 别名]
    def test_git_work_tree_dotgit(self, rw_dir):
        """Check that we find .git as a worktree file and find the worktree
        based on it."""
        git = Git(rw_dir)
        if git.version_info[:3] < (2, 5, 1):
            raise SkipTest("worktree feature unsupported")

        rw_master = self.rorepo.clone(join_path_native(rw_dir, 'master_repo'))
        branch = rw_master.create_head('aaaaaaaa')
        worktree_path = join_path_native(rw_dir, 'worktree_repo')
        if Git.is_cygwin():
            worktree_path = cygpath(worktree_path)
        rw_master.git.worktree('add', worktree_path, branch.name)

        # this ensures that we can read the repo's gitdir correctly
        repo = Repo(worktree_path)
        self.assertIsInstance(repo, Repo)

        # this ensures we're able to actually read the refs in the tree, which
        # means we can read commondir correctly.
        commit = repo.head.commit
        self.assertIsInstance(commit, Object)

        # this ensures we can read the remotes, which confirms we're reading
        # the config correctly.
        origin = repo.remotes.origin
        self.assertIsInstance(origin, Remote)

        self.assertIsInstance(repo.heads['aaaaaaaa'], Head)
开发者ID:gitpython-developers,项目名称:GitPython,代码行数:31,代码来源:test_repo.py

示例2: test_work_tree_unsupported

# 需要导入模块: from git import Git [as 别名]
# 或者: from git.Git import is_cygwin [as 别名]
    def test_work_tree_unsupported(self, rw_dir):
        git = Git(rw_dir)
        if git.version_info[:3] < (2, 5, 1):
            raise SkipTest("worktree feature unsupported")

        rw_master = self.rorepo.clone(join_path_native(rw_dir, 'master_repo'))
        rw_master.git.checkout('HEAD~10')
        worktree_path = join_path_native(rw_dir, 'worktree_repo')
        if Git.is_cygwin():
            worktree_path = cygpath(worktree_path)
        try:
            rw_master.git.worktree('add', worktree_path, 'master')
        except Exception as ex:
            raise AssertionError(ex, "It's ok if TC not running from `master`.")

        self.failUnlessRaises(InvalidGitRepositoryError, Repo, worktree_path)
开发者ID:gitprime,项目名称:GitPython,代码行数:18,代码来源:test_repo.py


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