本文整理汇总了Python中ellen.repo.Jagare类的典型用法代码示例。如果您正苦于以下问题:Python Jagare类的具体用法?Python Jagare怎么用?Python Jagare使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Jagare类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: push
def push(self, path, remote, ref, env):
try:
repo = Jagare(path)
ret = repo.push(remote, ref, _env=env)
return ProcessResultConverter(**ret).convert()
except Exception as e:
raise ServiceUnavailable(repr(e))
示例2: archive
def archive(self, path, prefix, ref):
try:
repo = Jagare(path)
stdout = repo.archive(prefix=prefix, ref=ref)
return stdout
except Exception as e:
raise ServiceUnavailable(repr(e))
示例3: merge_commits
def merge_commits(self, path, ours, theirs):
try:
repo = Jagare(path)
ret = repo.merge_tree(ours, theirs)
return MergeIndexConverter(**ret).convert()
except Exception as e:
raise ServiceUnavailable(repr(e))
示例4: update_head
def update_head(self, path, branch_name):
try:
repo = Jagare(path)
repo.update_head(branch_name)
return True
except Exception as e:
raise ServiceUnavailable(repr(e))
示例5: blame
def blame(self, path, ref, req_path, lineno):
try:
repo = Jagare(path)
ret = repo.blame(ref, path=req_path, lineno=lineno)
return BlameConverter(**ret).convert()
except Exception as e:
raise ServiceUnavailable(repr(e))
示例6: merge_base
def merge_base(self, path, to_sha, from_sha):
try:
repo = Jagare(path)
oid = repo.merge_base(to_sha, from_sha)
return oid.hex if oid else None
except Exception as e:
raise ServiceUnavailable(repr(e))
示例7: add_remote
def add_remote(self, path, name, url):
try:
repo = Jagare(path)
repo.add_remote(name, url)
return True
except Exception as e:
raise ServiceUnavailable(repr(e))
示例8: update_ref
def update_ref(self, path, ref, newvalue):
try:
repo = Jagare(path)
repo.update_ref(ref, newvalue)
return True
except Exception as e:
raise ServiceUnavailable(repr(e))
示例9: test_show_blob
def test_show_blob(self):
repo = Jagare(self.path)
ls = repo.ls_tree('master')
blobs = [item['sha'] for item in ls if item['type'] == 'blob']
for sha in blobs:
ret = repo.show(sha)
assert ret['type'] == 'blob'
示例10: delete_branch
def delete_branch(self, path, name):
try:
repo = Jagare(path)
repo.delete_branch(name)
return True
except Exception as e:
raise ServiceUnavailable(repr(e))
示例11: resolve_type
def resolve_type(self, path, version):
"""version means git object sha, return str of blob/tree/commit/tag"""
try:
repo = Jagare(path)
return repo.resolve_type(version)
except Exception as e:
raise ServiceUnavailable(repr(e))
示例12: get_temp_project
def get_temp_project(origin=None, repo_path=BARE_REPO_PATH):
if origin:
prefix_path = get_repo_root()
temp_repo_path = tempfile.mkdtemp(suffix=".git",
prefix="test_",
dir=prefix_path)
project_name = temp_repo_path[len(prefix_path) + 1:][:-4]
project = CodeDoubanProject.add(project_name,
TEMP_PROJECT_OWNER,
TEMP_PROJECT_DESCRIPTION,
fork_from=origin.id,
create_trac=False)
return project
prefix_path = get_repo_root()
temp_repo_path = tempfile.mkdtemp(suffix=".git",
prefix="test_",
dir=prefix_path)
project_name = temp_repo_path[len(prefix_path) + 1:][:-4]
project = CodeDoubanProject.add(project_name, TEMP_PROJECT_OWNER,
TEMP_PROJECT_DESCRIPTION)
shutil.rmtree(temp_repo_path)
repo = Jagare(repo_path)
repo.clone(temp_repo_path, bare=True)
return project
示例13: merge_head
def merge_head(self, path, ref):
try:
repo = Jagare(path)
ret = repo.merge_head(ref)
return MergeResultConverter(**ret).convert()
except Exception as e:
raise ServiceUnavailable(repr(e))
示例14: test_check_none_result
def test_check_none_result(tmpdir, Jagare):
path = tmpdir.strpath
JagareRepo.init(path, bare=True)
try:
sha = Jagare.resolve_commit(path, 'master')
except Exception as e:
assert type(e) in (NoneResult, NoneResultMock)
示例15: merge
def merge(self, path, ref, msg, commit_msg, no_ff, env):
try:
repo = Jagare(path)
ret = repo.merge(ref=ref, msg=msg, commit_msg=commit_msg,
no_ff=no_ff, _env=env)
return ProcessResultConverter(**ret).convert()
except Exception as e:
raise ServiceUnavailable(repr(e))