本文整理汇总了Python中git.repo.Repo.get_repository_location方法的典型用法代码示例。如果您正苦于以下问题:Python Repo.get_repository_location方法的具体用法?Python Repo.get_repository_location怎么用?Python Repo.get_repository_location使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类git.repo.Repo
的用法示例。
在下文中一共展示了Repo.get_repository_location方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_latest_status
# 需要导入模块: from git.repo import Repo [as 别名]
# 或者: from git.repo.Repo import get_repository_location [as 别名]
def get_latest_status(self):
"""
Property for viewing repository latest commit status message.
"""
repo = Repo(Repo.get_repository_location(self.owner.username, self.name))
return repo.get_latest_status()
示例2: remove_repo_signal
# 需要导入模块: from git.repo import Repo [as 别名]
# 或者: from git.repo.Repo import get_repository_location [as 别名]
def remove_repo_signal(sender, instance, using, **kwargs):
"""
Remove repository folder from server deposit after it's deletion.
"""
# Remove repository folder under GIT_DEPOSIT_ROOT/username/repository.git
remove_tree(Repo.get_repository_location(instance.owner.username, instance.name))
示例3: commits_stats
# 需要导入模块: from git.repo import Repo [as 别名]
# 或者: from git.repo.Repo import get_repository_location [as 别名]
def commits_stats(request, username, repository):
"""
Returns number of commits for the given repository.
"""
repo = Repo(Repo.get_repository_location(username, repository))
stats = GitStatistics(repo, repo.get_head())
return HttpResponse(json.dumps({'weekly': stats.for_commits(weekly, js), 'monthly': stats.for_commits(monthly, js)}))
示例4: readme
# 需要导入模块: from git.repo import Repo [as 别名]
# 或者: from git.repo.Repo import get_repository_location [as 别名]
def readme(request, username, repository, rev):
"""
Returns README content of a folder inside the given repository.
"""
repo = Repo(Repo.get_repository_location(username, repository))
request_sections = partition_url(request.path_info)
rdm = GitBlob(repo=repo, path='/'.join(request_sections[5:]), rev=rev).show()
return HttpResponse(rdm)
示例5: last_update
# 需要导入模块: from git.repo import Repo [as 别名]
# 或者: from git.repo.Repo import get_repository_location [as 别名]
def last_update(self):
"""
Property for viewing latest activty date on repository in "ISO 8601-like" format and 'UTC' timezone.
"""
last_update = Repo(Repo.get_repository_location(self.owner.username, self.name)).get_last_update()
if last_update is None:
return time_to_utc(str(self.creation_date))
else:
return last_update
示例6: init_bare_repo_signal
# 需要导入模块: from git.repo import Repo [as 别名]
# 或者: from git.repo.Repo import get_repository_location [as 别名]
def init_bare_repo_signal(sender, instance, created, **kwargs):
"""
Initialize a bare git repository on server's deposit after it's creation.
"""
if created:
# Create repository folder under GIT_DEPOSIT_ROOT/username/repository.git and initialize it as bare.
repository_location = Repo.get_repository_location(instance.owner.username, instance.name)
repo = Repo(repository_location)
repo.init_bare_repo()
示例7: save
# 需要导入模块: from git.repo import Repo [as 别名]
# 或者: from git.repo.Repo import get_repository_location [as 别名]
def save(self):
"""
Save method to create a new repository with provided information from registration form.
"""
data = self.cleaned_data
if self.edit:
self._update_instance(data)
if self.instance.name != self.repo_entering_name: # rename repository folder if it's name has changed.
rename_tree(Repo.get_repository_location(
self.instance.owner.username, self.repo_entering_name), '{0}.git'.format(self.instance.name))
elif not self.edit:
repository = Repository.objects.create(name=data['name'],
description=data['description'], owner=self.user, private=data['private'])
repository.save()