本文整理汇总了Python中ellen.repo.Jagare.init方法的典型用法代码示例。如果您正苦于以下问题:Python Jagare.init方法的具体用法?Python Jagare.init怎么用?Python Jagare.init使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ellen.repo.Jagare
的用法示例。
在下文中一共展示了Jagare.init方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_check_none_result
# 需要导入模块: from ellen.repo import Jagare [as 别名]
# 或者: from ellen.repo.Jagare import init [as 别名]
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)
示例2: init
# 需要导入模块: from ellen.repo import Jagare [as 别名]
# 或者: from ellen.repo.Jagare import init [as 别名]
def init(name):
repository_path = os.path.join(config.REPOS_PATH, name)
repository_path = endwith_git(repository_path)
repository_exist = is_repository(repository_path)
if repository_exist:
raise JagareError("repository already exists.", 409)
Jagare.init(repository_path)
return make_message_response("initialize success")
示例3: test_merge_head
# 需要导入模块: from ellen.repo import Jagare [as 别名]
# 或者: from ellen.repo.Jagare import init [as 别名]
def test_merge_head(tmpdir, Jagare):
path = tmpdir.strpath
git_dir = os.path.join(path, '.git')
# `git merge` must be run in a work tree
t_repo = JagareRepo.init(git_dir,
work_path=path, bare=False)
temp_repo.commit_something(git_dir, file_name='git_init')
BR = 'br_test_merge'
ret = t_repo.create_branch(BR, 'master')
assert ret is True
sha1 = t_repo.sha('master')
temp_repo.commit_something(path, branch=BR)
ret = Jagare.merge_head(path, BR)
# sha2 = t_repo.sha('master')
# assert sha1 != sha2
assert t_repo.sha(sha1) == sha1
assert ret.is_fastforward is True
assert ret.fastforward_oid
assert ret.is_uptodate is False
示例4: test_merge
# 需要导入模块: from ellen.repo import Jagare [as 别名]
# 或者: from ellen.repo.Jagare import init [as 别名]
def test_merge(tmpdir, no_ff, Jagare):
path = tmpdir.strpath
git_dir = os.path.join(path, '.git')
# `git merge` must be run in a work tree
t_repo = JagareRepo.init(git_dir,
work_path=path, bare=False)
temp_repo.commit_something(git_dir, file_name='git_init')
BR = 'br_test_merge'
ret = t_repo.create_branch(BR, 'master')
assert ret is True
sha1 = t_repo.sha('master')
temp_repo.commit_something(path, branch=BR)
ret = Jagare.merge(path, ref=BR, msg=None, commit_msg=None,
no_ff=no_ff, env=None)
sha2 = t_repo.sha('master')
assert sha1 != sha2
assert t_repo.sha(sha1) == sha1
assert ret.stdout
assert ret.stderr == ''
assert ret.fullcmd
assert ret.returncode == 0
示例5: test_empty
# 需要导入模块: from ellen.repo import Jagare [as 别名]
# 或者: from ellen.repo.Jagare import init [as 别名]
def test_empty(self):
self.clean()
repo = Jagare.init(self.path, work_path=self.path)
pygit2_repo = Repository(self.path)
assert is_repository(self.path) is True
assert repo.empty is True
assert repo.bare is False
assert pygit2_repo.is_empty is True
assert pygit2_repo.is_bare is False
示例6: test_bare
# 需要导入模块: from ellen.repo import Jagare [as 别名]
# 或者: from ellen.repo.Jagare import init [as 别名]
def test_bare(self):
self.clean()
repo = Jagare.init(self.path, bare=True)
pygit2_repo = Repository(self.path)
assert is_repository(self.path) is True
assert repo.empty is True
assert repo.bare is True
assert pygit2_repo.is_empty is True
assert pygit2_repo.is_bare is True
示例7: test_push
# 需要导入模块: from ellen.repo import Jagare [as 别名]
# 或者: from ellen.repo.Jagare import init [as 别名]
def test_push(self):
repo = Jagare(self.path)
path2 = self.get_temp_path()
repo2 = Jagare.init(path2, bare=True)
assert repo2.empty
repo.add_remote('origin', repo2.path)
repo.push('origin', 'master')
assert not repo2.empty
示例8: init
# 需要导入模块: from ellen.repo import Jagare [as 别名]
# 或者: from ellen.repo.Jagare import init [as 别名]
def init(self, to_path, work_path, is_bare):
try:
to_repo = Jagare.init(path=to_path, work_path=work_path,
bare=is_bare)
return Repository(path=to_repo.path,
is_empty=to_repo.empty,
is_bare=to_repo.bare,
workdir=to_repo.repository.workdir,
head=to_repo.head and to_repo.head.name)
except Exception as e:
raise ServiceUnavailable(repr(e))
示例9: test_push
# 需要导入模块: from ellen.repo import Jagare [as 别名]
# 或者: from ellen.repo.Jagare import init [as 别名]
def test_push(tmpdir, Jagare):
path = tmpdir.mkdir('source').strpath
path2 = tmpdir.mkdir('target').strpath
repo = temp_repo.create_temp_repo(path, is_bare=True)
repo2 = JagareRepo.init(path2, bare=True)
assert repo2.empty is True
repo.add_remote('origin', repo2.path)
ret = Jagare.push(path, 'origin', 'master', env={})
assert not repo2.empty
assert ret.stdout is not None # why stdout == ''
assert ret.stderr is not None # why stderr != ''
assert ret.fullcmd
assert ret.returncode == 0
示例10: create_temp_repo
# 需要导入模块: from ellen.repo import Jagare [as 别名]
# 或者: from ellen.repo.Jagare import init [as 别名]
def create_temp_repo(path, is_bare=True):
repo = Jagare.init(path, bare=is_bare)
data = [('test_file',
"""test_content
test_content
test_content
""",
'insert')]
repo.commit_file(branch='master',
parent='master',
author_name='testuser',
author_email='[email protected]',
message='first commit',
reflog='commit one file',
data=data)
return repo
示例11: init
# 需要导入模块: from ellen.repo import Jagare [as 别名]
# 或者: from ellen.repo.Jagare import init [as 别名]
def init(self):
path = os.path.join(self.temp_dir, '.git')
work_path = self.temp_dir
return Jagare.init(path, work_path=work_path, bare=False)
示例12: init
# 需要导入模块: from ellen.repo import Jagare [as 别名]
# 或者: from ellen.repo.Jagare import init [as 别名]
def init(self):
import os
path = os.path.join(self.temp_dir, ".git")
work_path = self.temp_dir
return Jagare.init(path, work_path=work_path, bare=False)