コード例 #1
0
ファイル: jagare_handler.py プロジェクト: tclh123/jagare-rpc
    def merge_flow(self, path, merger_name, merger_email, message_header,
                   message_body, from_repo_path, from_ref, to_ref, remote_name,
                   no_ff):
        """merge with worktree(tmpdir)"""
        try:
            repo = Jagare(path)
            with get_tmpdir() as tmpdir:

                assert tmpdir

                ret = repo.merge_flow(merger_name,
                                      merger_email,
                                      message_header,
                                      message_body,
                                      tmpdir,
                                      from_repo_path,
                                      from_ref,
                                      to_ref,
                                      remote_name=remote_name,
                                      no_ff=no_ff)

                assert ret

            return ret
        except Exception as e:
            raise ServiceUnavailable(repr(e))
コード例 #2
0
    def test_merge_flow(self):
        repo = Jagare(self.path)
        BR = 'br_test_merge'
        sha1 = repo.sha(BARE_REPO_OTHER_BRANCH)

        from_repo_path = self.get_temp_path()
        from_repo = repo.clone(from_repo_path,
                               branch=BARE_REPO_OTHER_BRANCH,
                               bare=True)
        ret = from_repo.create_branch(BR, BARE_REPO_OTHER_BRANCH)
        assert ret
        commit_something(from_repo_path, branch=BR)

        tmpdir = self.get_temp_path()

        # different repo
        sha = repo.merge_flow('lh',
                              '*****@*****.**',
                              'test_header',
                              'test_body',
                              tmpdir,
                              from_repo_path,
                              BR,
                              BARE_REPO_OTHER_BRANCH,
                              remote_name='hub/xxxproject',
                              no_ff=True)
        assert sha

        sha2 = repo.sha(BARE_REPO_OTHER_BRANCH)

        assert sha1 != sha2
        assert repo.sha(sha1) == sha1

        # same repo
        tmpdir2 = self.get_temp_path()
        from_sha1 = from_repo.sha(BARE_REPO_OTHER_BRANCH)
        assert from_sha1 == sha1
        sha = from_repo.merge_flow('lh',
                                   '*****@*****.**',
                                   'test_header',
                                   'test_body',
                                   tmpdir2,
                                   from_repo_path,
                                   BR,
                                   BARE_REPO_OTHER_BRANCH,
                                   no_ff=True)
        assert sha
        from_sha2 = from_repo.sha(BARE_REPO_OTHER_BRANCH)
        assert from_sha1 != from_sha2
        assert from_repo.sha(from_sha1) == from_sha1
コード例 #3
0
ファイル: jagare_handler.py プロジェクト: tclh123/jagare-rpc
    def merge_flow(self, path, merger_name, merger_email,
                   message_header, message_body,
                   from_repo_path, from_ref, to_ref,
                   remote_name, no_ff):
        """merge with worktree(tmpdir)"""
        try:
            repo = Jagare(path)
            with get_tmpdir() as tmpdir:

                assert tmpdir

                ret = repo.merge_flow(merger_name, merger_email,
                                      message_header, message_body, tmpdir,
                                      from_repo_path, from_ref, to_ref,
                                      remote_name=remote_name, no_ff=no_ff)

                assert ret

            return ret
        except Exception as e:
            raise ServiceUnavailable(repr(e))
コード例 #4
0
ファイル: test_merge.py プロジェクト: tclh123/ellen
    def test_merge_flow(self):
        repo = Jagare(self.path)
        BR = 'br_test_merge'
        sha1 = repo.sha(BARE_REPO_OTHER_BRANCH)

        from_repo_path = self.get_temp_path()
        from_repo = repo.clone(from_repo_path, branch=BARE_REPO_OTHER_BRANCH,
                               bare=True)
        ret = from_repo.create_branch(BR, BARE_REPO_OTHER_BRANCH)
        assert ret
        commit_something(from_repo_path, branch=BR)

        tmpdir = self.get_temp_path()

        # different repo
        sha = repo.merge_flow('lh', '*****@*****.**',
                              'test_header', 'test_body', tmpdir,
                              from_repo_path, BR, BARE_REPO_OTHER_BRANCH,
                              remote_name='hub/xxxproject', no_ff=True)
        assert sha

        sha2 = repo.sha(BARE_REPO_OTHER_BRANCH)

        assert sha1 != sha2
        assert repo.sha(sha1) == sha1

        # same repo
        tmpdir2 = self.get_temp_path()
        from_sha1 = from_repo.sha(BARE_REPO_OTHER_BRANCH)
        assert from_sha1 == sha1
        sha = from_repo.merge_flow('lh', '*****@*****.**',
                                   'test_header', 'test_body', tmpdir2,
                                   from_repo_path, BR, BARE_REPO_OTHER_BRANCH,
                                   no_ff=True)
        assert sha
        from_sha2 = from_repo.sha(BARE_REPO_OTHER_BRANCH)
        assert from_sha1 != from_sha2
        assert from_repo.sha(from_sha1) == from_sha1