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


Python GitClient.get_status方法代码示例

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


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

示例1: test_status

# 需要导入模块: from vcstools.git import GitClient [as 别名]
# 或者: from vcstools.git.GitClient import get_status [as 别名]
    def test_status(self):
        url = self.remote_path
        client = GitClient(self.local_path)
        self.assertTrue(client.checkout(url))
        output = client.get_status()
        self.assertEqual('', output, output)

        with open(os.path.join(self.local_path, 'fixed.txt'), 'a') as f:
            f.write('0123456789abcdef')
        subprocess.check_call("touch new.txt", shell=True, cwd=self.local_path)
        with open(os.path.join(self.sublocal_path, 'subfixed.txt'), 'a') as f:
            f.write('abcdef0123456789')
        subprocess.check_call("touch subnew.txt", shell=True, cwd=self.sublocal_path)
        with open(os.path.join(self.subsublocal_path, 'subsubfixed.txt'), 'a') as f:
            f.write('012345cdef')
        subprocess.check_call("touch subsubnew.txt", shell=True, cwd=self.subsublocal_path)

        output = client.get_status()
        self.assertEqual(' M ./fixed.txt\n M ./submodule\n M ./subfixed.txt\n M ./subsubmodule\n M ./subsubfixed.txt', output.rstrip())

        output = client.get_status(untracked = True)
        self.assertEqual(' M ./fixed.txt\n M ./submodule\n?? ./new.txt\n M ./subfixed.txt\n M ./subsubmodule\n?? ./subnew.txt\n M ./subsubfixed.txt\n?? ./subsubnew.txt', output.rstrip())

        output = client.get_status(basepath=os.path.dirname(self.local_path), untracked = True)
        self.assertEqual(' M local/fixed.txt\n M local/submodule\n?? local/new.txt\n M local/subfixed.txt\n M local/subsubmodule\n?? local/subnew.txt\n M local/subsubfixed.txt\n?? local/subsubnew.txt', output.rstrip())
开发者ID:tkruse,项目名称:vcstools,代码行数:27,代码来源:test_git_subm.py

示例2: test_status

# 需要导入模块: from vcstools.git import GitClient [as 别名]
# 或者: from vcstools.git.GitClient import get_status [as 别名]
    def test_status(self):
        url = self.repo_path
        client = GitClient(self.local_path)
        self.assertTrue(client.checkout(url))
        output = client.get_status(porcelain=True)  # porcelain=True ensures stable format
        self.assertEqual('', output, "Expected empty string, got `{0}`".format(output))

        with open(os.path.join(self.local_path, 'fixed.txt'), 'a') as f:
            f.write('0123456789abcdef')
        subprocess.check_call("touch new.txt", shell=True, cwd=self.local_path)
        with open(os.path.join(self.sublocal_path, 'subfixed.txt'), 'a') as f:
            f.write('abcdef0123456789')
        subprocess.check_call("touch subnew.txt", shell=True, cwd=self.sublocal_path)
        with open(os.path.join(self.subsublocal_path, 'subsubfixed.txt'), 'a') as f:
            f.write('012345cdef')
        subprocess.check_call("touch subsubnew.txt", shell=True, cwd=self.subsublocal_path)

        output = client.get_status(porcelain=True)  # porcelain=True ensures stable format
        self.assertEqual('''\
 M ./fixed.txt
 M ./submodule
 M ./subfixed.txt
 M ./subsubmodule
 M ./subsubfixed.txt''', output.rstrip())

        output = client.get_status(untracked=True, porcelain=True)
        self.assertEqual('''\
 M ./fixed.txt
 M ./submodule
?? ./new.txt
 M ./subfixed.txt
 M ./subsubmodule
?? ./subnew.txt
 M ./subsubfixed.txt
?? ./subsubnew.txt''', output.rstrip())

        output = client.get_status(
            basepath=os.path.dirname(self.local_path),
            untracked=True,
            porcelain=True)
        self.assertEqual('''\
 M local/fixed.txt
 M local/submodule
?? local/new.txt
 M local/subfixed.txt
 M local/subsubmodule
?? local/subnew.txt
 M local/subsubfixed.txt
?? local/subsubnew.txt''', output.rstrip())
开发者ID:vcstools,项目名称:vcstools,代码行数:51,代码来源:test_git_subm.py

示例3: testStatusUntracked

# 需要导入模块: from vcstools.git import GitClient [as 别名]
# 或者: from vcstools.git.GitClient import get_status [as 别名]
 def testStatusUntracked(self):
     from vcstools.git import GitClient
     client = GitClient(self.readonly_path)
     self.assertTrue(client.path_exists())
     self.assertTrue(client.detect_presence())
     self.assertEquals('A  ./added.txt\n D ./deleted-fs.txt\nD  ./deleted.txt\n M ./modified-fs.txt\nM  ./modified.txt\n?? ./added-fs.txt\n', client.get_status(untracked=True))
开发者ID:130s,项目名称:dry_prerelease_job_generator,代码行数:8,代码来源:test_git.py

示例4: testStatusRelPath

# 需要导入模块: from vcstools.git import GitClient [as 别名]
# 或者: from vcstools.git.GitClient import get_status [as 别名]
 def testStatusRelPath(self):
     from vcstools.git import GitClient
     client = GitClient(self.readonly_path)
     self.assertTrue(client.path_exists())
     self.assertTrue(client.detect_presence())
     self.assertEquals('A  readonly/added.txt\n D readonly/deleted-fs.txt\nD  readonly/deleted.txt\n M readonly/modified-fs.txt\nM  readonly/modified.txt\n', client.get_status(basepath=os.path.dirname(self.readonly_path)))
开发者ID:130s,项目名称:dry_prerelease_job_generator,代码行数:8,代码来源:test_git.py


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