本文整理汇总了Python中vcstools.git.GitClient.get_url方法的典型用法代码示例。如果您正苦于以下问题:Python GitClient.get_url方法的具体用法?Python GitClient.get_url怎么用?Python GitClient.get_url使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vcstools.git.GitClient
的用法示例。
在下文中一共展示了GitClient.get_url方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _get_file
# 需要导入模块: from vcstools.git import GitClient [as 别名]
# 或者: from vcstools.git.GitClient import get_url [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
示例2: _get_file
# 需要导入模块: from vcstools.git import GitClient [as 别名]
# 或者: from vcstools.git.GitClient import get_url [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
示例3: test_get_url_by_reading
# 需要导入模块: from vcstools.git import GitClient [as 别名]
# 或者: from vcstools.git.GitClient import get_url [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)
示例4: test_checkout
# 需要导入模块: from vcstools.git import GitClient [as 别名]
# 或者: from vcstools.git.GitClient import get_url [as 别名]
def test_checkout(self):
from vcstools.git import GitClient
directory = tempfile.mkdtemp()
self.directories["checkout_test"] = directory
local_path = os.path.join(directory, "ros")
url = self.readonly_url
client = GitClient(local_path)
self.assertFalse(client.path_exists())
self.assertFalse(client.detect_presence())
self.assertFalse(client.detect_presence())
self.assertTrue(client.checkout(url))
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_branch(), "master")
self.assertEqual(client.get_branch_parent(), "master")
#self.assertEqual(client.get_version(), '-r*')
shutil.rmtree(directory)
self.directories.pop("checkout_test")
示例5: checkout_package
# 需要导入模块: from vcstools.git import GitClient [as 别名]
# 或者: from vcstools.git.GitClient import get_url [as 别名]
def checkout_package(self, package_name):
"""Fetches and checks out the correct version of a package for the rosdistro"""
pkg_info = self._rosdist.get_package_checkout_info()[package_name]
repo_url = pkg_info['url']
name = os.path.basename(pkg_info['url'])
repo_path = os.path.join(self.workspace, name)
client = GitClient(repo_path)
if client.path_exists():
tag = pkg_info['version'] if client.is_tag(pkg_info['version']) else pkg_info['full_version']
if client.get_url() == repo_url:
# Sometimes debian/rules gets mussed with in the build process.
# This should translate to 'git checkout debian/rules' which should reset so we can change tags
client.update('debian/rules', verbose=True)
updated = client.update(tag, force_fetch=True, verbose=True)
if not updated:
print("WARNING: Repo at %s changed url from %s to %s or update failed. Redownloading!" % (repo_path, client.get_url(), repo_url))
shutil.rmtree(repo_path)
self.fetch_with_tagcheck(client, pkg_info)
else:
self.fetch_with_tagcheck(client, pkg_info)
return repo_path
示例6: test_checkout_specific_branch_and_update
# 需要导入模块: from vcstools.git import GitClient [as 别名]
# 或者: from vcstools.git.GitClient import get_url [as 别名]
def test_checkout_specific_branch_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
branch = "master"
client = GitClient(local_path)
self.assertFalse(client.path_exists())
self.assertFalse(client.detect_presence())
self.assertTrue(client.checkout(url, branch))
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_branch_parent(), branch)
new_branch = 'master'
self.assertTrue(client.update(new_branch))
self.assertEqual(client.get_branch_parent(), new_branch)
shutil.rmtree(directory)
self.directories.pop(subdir)
示例7: test_get_url_nonexistant
# 需要导入模块: from vcstools.git import GitClient [as 别名]
# 或者: from vcstools.git.GitClient import get_url [as 别名]
def test_get_url_nonexistant(self):
from vcstools.git import GitClient
local_path = "/tmp/dummy"
client = GitClient(local_path)
self.assertEqual(client.get_url(), None)