def test_merge_commits(self): repo = Jagare(self.path) BR = 'br_test_merge' path = self.get_temp_path() # repo has work-tree repo.clone(path, branch=BARE_REPO_OTHER_BRANCH) repo = Jagare(os.path.join(path, '.git')) ret = repo.create_branch(BR, BARE_REPO_OTHER_BRANCH) assert ret commit_something(path, branch=BR) repo.update_head(BARE_REPO_OTHER_BRANCH) merge_index = repo.merge_commits(repo.head.target.hex, BR) assert merge_index['has_conflicts'] == False
def test_merge_head(self): repo = Jagare(self.path) BR = 'br_test_merge' path = self.get_temp_path() # repo has work-tree repo.clone(path, branch=BARE_REPO_OTHER_BRANCH) repo = Jagare(os.path.join(path, '.git')) ret = repo.create_branch(BR, BARE_REPO_OTHER_BRANCH) assert ret commit_something(path, branch=BR) repo.update_head(BARE_REPO_OTHER_BRANCH) merge_result = repo.merge_head(BR) assert merge_result['is_fastforward']
def test_merge_commits(self): repo = Jagare(self.path) BR = 'br_test_merge' path = self.get_temp_path() # repo has work-tree repo.clone(path, branch=BARE_REPO_OTHER_BRANCH) repo = Jagare(os.path.join(path, '.git')) ret = repo.create_branch(BR, BARE_REPO_OTHER_BRANCH) assert ret commit_something(path, branch=BR) repo.update_head(BARE_REPO_OTHER_BRANCH) merge_index = repo.merge_commits(repo.head.target.hex, BR) assert merge_index['has_conflicts'] is False
def _merge(self, no_ff): repo = Jagare(self.path) BR = 'br_test_merge' path = self.get_temp_path() # repo has work-tree repo.clone(path, branch=BARE_REPO_OTHER_BRANCH) repo = Jagare(os.path.join(path, '.git')) ret = repo.create_branch(BR, BARE_REPO_OTHER_BRANCH) assert ret sha1 = repo.sha(BARE_REPO_OTHER_BRANCH) commit_something(path, branch=BR) repo.update_head(BARE_REPO_OTHER_BRANCH) ret = repo.merge(BR, no_ff=no_ff) sha2 = repo.sha(BARE_REPO_OTHER_BRANCH) assert sha1 != sha2 assert repo.sha(sha1) == sha1
def create_branch(self, path, name, ref, force): try: repo = Jagare(path) return repo.create_branch(name, ref, force) except Exception as e: raise ServiceUnavailable(repr(e))
def test_create(self): repo = Jagare(self.path) repo.create_branch('br_test', 'master') assert repo.sha('br_test') == repo.sha('master')