當前位置: 首頁>>代碼示例>>Python>>正文


Python GitClient.get_version方法代碼示例

本文整理匯總了Python中vcstools.git.GitClient.get_version方法的典型用法代碼示例。如果您正苦於以下問題:Python GitClient.get_version方法的具體用法?Python GitClient.get_version怎麽用?Python GitClient.get_version使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在vcstools.git.GitClient的用法示例。


在下文中一共展示了GitClient.get_version方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_get_url_by_reading

# 需要導入模塊: from vcstools.git import GitClient [as 別名]
# 或者: from vcstools.git.GitClient import get_version [as 別名]
    def test_get_url_by_reading(self):
        from vcstools.git import GitClient

        client = GitClient(self.readonly_path)
        self.assertTrue(client.path_exists())
        self.assertTrue(client.detect_presence())
        self.assertEqual(client.get_url(), self.readonly_url)
        self.assertEqual(client.get_version(), self.readonly_version)
        self.assertEqual(client.get_version(self.readonly_version_init[0:6]), self.readonly_version_init)
        self.assertEqual(client.get_version("test_tag"), self.readonly_version_init)
開發者ID:130s,項目名稱:dry_prerelease_job_generator,代碼行數:12,代碼來源:test_git.py

示例2: _get_file

# 需要導入模塊: from vcstools.git import GitClient [as 別名]
# 或者: from vcstools.git.GitClient import get_version [as 別名]
    def _get_file(self, repo_type, repo_url, version, filename):
        """ Fetch the file specificed by filename relative to the root of the repository"""
        name = simplify_repo_name(repo_url)
        repo_path = os.path.join(self._cache_location, name)
        #client = VcsClient(repo_type, repo_path)
        client = GitClient(repo_path)  # using git only
        updated = False
        if client.path_exists():
            if client.get_url() == repo_url:
                if not self._skip_update:
                    updated = client.update(version, force_fetch=True)
                else:
                    updated = client._do_update(version)
            if not updated:
                shutil.rmtree(repo_path)
        if not updated:
            updated = client.checkout(repo_url, version, shallow=True)

        if not updated:
            raise VcsError("Impossible to update/checkout repo '%s' with version '%s'." % (repo_url, version))

        full_filename = os.path.join(repo_path, filename)
        if not os.path.exists(full_filename):
            raise VcsError("Requested file '%s' missing from repo '%s' version '%s' (viewed at version '%s').  It was expected at: %s" %
                           (filename, repo_url, version, client.get_version(), full_filename))

        return full_filename
開發者ID:po1,項目名稱:buildfarm,代碼行數:29,代碼來源:dependency_walker.py

示例3: _get_file

# 需要導入模塊: from vcstools.git import GitClient [as 別名]
# 或者: from vcstools.git.GitClient import get_version [as 別名]
    def _get_file(self, _repo_type, repo_url, version, filename):
        """ Fetch the file specificed by filename relative to the root of the repository"""
        name = simplify_repo_name(repo_url)
        repo_path = os.path.join(self._cache_location, name)
        client = GitClient(repo_path)  # using git only
        updated = False
        if client.path_exists():
            if client.get_url() == repo_url:
                if not self._skip_update:
                    logging.disable(logging.WARNING)
                    updated = client.update(version, force_fetch=True)
                    logging.disable(logging.NOTSET)
                else:
                    try:  # catch exception which can be caused by calling internal API
                        logging.disable(logging.WARNING)
                        updated = client._do_update(version)
                        logging.disable(logging.NOTSET)
                    except GitError:
                        updated = False
            if not updated:
                shutil.rmtree(repo_path)
        if not updated:
            logging.disable(logging.WARNING)
            updated = client.checkout(repo_url, version)
            logging.disable(logging.NOTSET)

        if not updated:
            raise VcsError("Impossible to update/checkout repo '%s' with version '%s'." % (repo_url, version))

        full_filename = os.path.join(repo_path, filename)
        if not os.path.exists(full_filename):
            raise VcsError("Requested file '%s' missing from repo '%s' version '%s' (viewed at version '%s').  It was expected at: %s" %
                           (filename, repo_url, version, client.get_version(), full_filename))

        return full_filename
開發者ID:jamuraa,項目名稱:catkin-debs,代碼行數:37,代碼來源:dependency_walker.py

示例4: test_checkout_master_with_subs

# 需要導入模塊: from vcstools.git import GitClient [as 別名]
# 或者: from vcstools.git.GitClient import get_version [as 別名]
 def test_checkout_master_with_subs(self):
     url = self.remote_path
     client = GitClient(self.local_path)
     subclient = GitClient(self.sublocal_path)
     subsubclient = GitClient(self.subsublocal_path)
     self.assertFalse(client.path_exists())
     self.assertFalse(client.detect_presence())
     self.assertTrue(client.checkout(url))
     self.assertTrue(client.path_exists())
     self.assertTrue(client.detect_presence())
     self.assertEqual(self.version_final, client.get_version())
     self.assertTrue(subclient.path_exists())
     self.assertTrue(subclient.detect_presence())
     self.assertEqual(self.subversion_final, subclient.get_version())
     self.assertTrue(subsubclient.path_exists())
     self.assertTrue(subsubclient.detect_presence())
     self.assertEqual(self.subsubversion_final, subsubclient.get_version())
開發者ID:tkruse,項目名稱:vcstools,代碼行數:19,代碼來源:test_git_subm.py

示例5: test_checkout_branch_with_subs

# 需要導入模塊: from vcstools.git import GitClient [as 別名]
# 或者: from vcstools.git.GitClient import get_version [as 別名]
 def test_checkout_branch_with_subs(self):
     url = self.remote_path
     client = GitClient(self.local_path)
     subclient = GitClient(self.sublocal_path)
     subsubclient = GitClient(self.subsublocal_path)
     self.assertFalse(client.path_exists())
     self.assertFalse(client.detect_presence())
     self.assertTrue(client.checkout(url, refname='test_branch'))
     self.assertTrue(client.path_exists())
     self.assertTrue(client.detect_presence())
     self.assertEqual(self.version_init, client.get_version())
     self.assertFalse(subclient.path_exists())
開發者ID:tkruse,項目名稱:vcstools,代碼行數:14,代碼來源:test_git_subm.py

示例6: test_checkout_specific_version_and_update

# 需要導入模塊: from vcstools.git import GitClient [as 別名]
# 或者: from vcstools.git.GitClient import get_version [as 別名]
 def test_checkout_specific_version_and_update(self):
     from vcstools.git import GitClient
     directory = tempfile.mkdtemp()
     subdir = "checkout_specific_version_test"
     self.directories[subdir] = directory
     local_path = os.path.join(directory, "ros")
     url = self.readonly_url
     version = self.readonly_version
     client = GitClient(local_path)
     self.assertFalse(client.path_exists())
     self.assertFalse(client.detect_presence())
     self.assertTrue(client.checkout(url, version))
     self.assertTrue(client.path_exists())
     self.assertTrue(client.detect_presence())
     self.assertEqual(client.get_path(), local_path)
     self.assertEqual(client.get_url(), url)
     self.assertEqual(client.get_version(), version)
     
     new_version = self.readonly_version_second
     self.assertTrue(client.update(new_version))
     self.assertEqual(client.get_version(), new_version)
     
     shutil.rmtree(directory)
     self.directories.pop(subdir)
開發者ID:130s,項目名稱:dry_prerelease_job_generator,代碼行數:26,代碼來源:test_git.py


注:本文中的vcstools.git.GitClient.get_version方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。