def send_pullreq(branch, remote='upstream', remote_branch=None): remote, fetch_args, baseref = get_base_branch(branch, remote=remote, remote_branch=remote_branch) base_repo = get_remote_repo_name(remote) if branch.startswith('pr/') and remote_branch is None: # for pr-on-pr remote, pr_id = remote_and_pr_id_from_pr_branch(branch) base_repo, baseref = get_pullinfo(get_remote_repo_name(remote), pr_id) _send_pullreq(get_remote_repo_name('origin'), branch, base_repo, baseref)
def send_pullreq(branch, remote='upstream', remote_branch=None): remote, fetch_args, baseref = get_base_branch(branch, remote=remote, remote_branch=remote_branch) base_repo = get_remote_repo_name(remote) if branch.startswith('pr/'): # for pr-on-pr remote, pr_id = remote_and_pr_id_from_pr_branch(branch) info = get_pullinfo(get_remote_repo_name(remote), pr_id) base_repo = info['head']['repo']['name'] baseref = info['head']['ref'] _send_pullreq(get_remote_repo_name('origin'), branch, base_repo, baseref)
def test_get_repo_name_with_user(): with patch.object(M, 'getoutput') as mock_getoutput: mock_getoutput.return_value = """\ origin http://[email protected]/testrepo.git (fetch) origin http://[email protected]/testrepo.git (push) upstream http://code.dapps.douban.com/testrepo.git (fetch) upstream http://code.dapps.douban.com/testrepo.git (push) """ n = M.get_remote_repo_name('origin') eq_(n, 'testrepo')
def test_get_repo_name(): with patch.object(M, "getoutput") as mock_getoutput: mock_getoutput.return_value = """\ origin http://code.dapps.douban.com/testrepo.git (fetch) origin http://code.dapps.douban.com/testrepo.git (push) upstream http://code.dapps.douban.com/testrepo.git (fetch) upstream http://code.dapps.douban.com/testrepo.git (push) """ n = M.get_remote_repo_name("origin") eq_(n, "testrepo")
def send_merge_pullreq(from_branch, to_branch): repo = get_remote_repo_name('upstream') send_pullreq(repo, from_branch, repo, to_branch)
def send_merge_pullreq(from_branch, to_branch): repo = get_remote_repo_name("upstream") send_pullreq(repo, from_branch, repo, to_branch)