def main(args): name = args.upstream code_username = '' if not args.origin: code_username = get_code_username() if not code_username: log_error('origin not specified') return 1 repo_name = name.split('/')[-1] args.origin = '%s/%s' % (code_username, repo_name) if not args.dir: args.dir = name.rsplit('/')[-1] print_log("Destination dir is not specified, will use {}".format( args.dir)) check_call([ 'git', 'clone', repo_git_url(args.origin, login_user=code_username, provider=args.provider), args.dir, ]) with cd(args.dir): merge_config() check_call(['git', 'remote', 'add', 'upstream', repo_git_url(name)])
def send_pullreq(self, head_repo, head_ref, base_repo, base_ref): url = (('http://code.dapps.douban.com/%s/newpull/new?' % head_repo) + urllib.urlencode(dict(head_ref=head_ref, base_ref=base_ref, base_repo=base_repo))) utils.print_log("goto " + url) utils.browser_open(url)
def send_pullreq(self, head_repo, head_ref, base_repo, base_ref): head_user, _ = head_repo.split("/") base_user, _ = base_repo.split("/") url = "https://github.com/%s/compare/%s:%s...%s:%s?expand=1" % ( head_repo, base_user, base_ref, head_user, head_ref) utils.print_log("goto " + url) utils.browser_open(url)
def send_pullreq(self, head_repo, head_ref, base_repo, base_ref): url = ('http://code.dapps.douban.com/%s/newpull/new?' % head_repo) + urlencode( dict(head_ref=head_ref, base_ref=base_ref, base_repo=base_repo)) utils.print_log("goto " + url) utils.browser_open(url)
def submit_new_pullreq(remote='upstream', remote_branch=None, no_merge=False): branch = get_current_branch_name() if branch == 'master': print_log('Pull request should never be from master') return 1 if not no_merge: rebase = not branch_is_published_already(branch) merge_with_base(branch, rebase=rebase, remote=remote, remote_branch=remote_branch) push_to_my_fork(branch) send_pullreq(branch, remote=remote, remote_branch=remote_branch)
def send_pullreq(self, head_repo, head_ref, base_repo, base_ref): head_user, _ = head_repo.split("/") base_user, _ = base_repo.split("/") url = "https://git.ein.plus/%s/-/merge_requests/new?" % head_repo + urlencode( { 'merge_request[source_branch]': head_ref, 'merge_request[source_project]': head_user, 'merge_request[target_branch]': base_ref, 'merge_request[target_project]': base_user, }) utils.print_log("goto " + url) utils.browser_open(url)
def main(args): name = args.upstream code_username = '' if not args.origin: code_username = get_code_username() if not code_username: log_error('origin not specified') return 1 args.origin = '%s/%s' % (code_username, name) if not args.dir: args.dir = name.rsplit('/')[-1] print_log("Destination dir is not specified, will use {}".format(args.dir)) check_call(['git', 'clone', repo_git_url(args.origin, login_user=code_username), args.dir]) with cd(args.dir): merge_config() check_call(['git', 'remote', 'add', 'upstream', repo_git_url(name)])