コード例 #1
0
def main(args):
    branches = args.branches
    if not branches:
        branches = [get_current_branch_name()]
    assert 'master' not in branches, "Cannot terminate master branch!"
    for br in branches:
        try:
            end_branch(br, args.force)
        except subprocess.CalledProcessError as e:
            print(e)
            log_error("Fail to delete branch %s." % br)
コード例 #2
0
ファイル: end.py プロジェクト: hongqn/codecli
def main(args):
    branches = args.branches
    if not branches:
        branches = [get_current_branch_name()]
    assert 'master' not in branches, "Cannot terminate master branch!"
    for br in branches:
        try:
            end_branch(br, args.force)
        except subprocess.CalledProcessError as e:
            print(e)
            log_error("Fail to delete branch %s." % br)
コード例 #3
0
ファイル: pullreq.py プロジェクト: kirk91/codecli
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)
コード例 #4
0
ファイル: sync.py プロジェクト: joest67/codecli
def main(args):
    branch = get_current_branch_name()
    if args.action == 'pull':
        merge_with_base(branch,
                        rebase=args.rebase,
                        remote_branch=args.base,
                        remote=args.remote)
    else:
        sync_to_remote(branch,
                       remote=args.remote,
                       remote_branch=args.base,
                       force=args.force)
コード例 #5
0
ファイル: pullreq.py プロジェクト: CCv5/codecli
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)
コード例 #6
0
ファイル: end.py プロジェクト: hongqn/codecli
def end_branch(branch, force):
    if branch == get_current_branch_name():
        check_call(['git', 'checkout', 'master'])
    if force:
        check_call(['git', 'branch', '-D', branch])
    else:
        try:
            check_call(['git', 'branch', '-d', branch])
        except subprocess.CalledProcessError:
            log_error("Failed to delete branch %s because it is not fully "
                      "merged (may cause commits loss)." % branch)
            answer = ask("Do you want to force to delete it even so? (y/N) ",
                         pattern=r'[nNyY].*', default='n')
            if answer[0] in 'yY':
                check_call(['git', 'branch', '-D', branch])
            else:
                raise

    if does_branch_exist_on_origin(branch):
        check_call(['git', 'push', 'origin', ':%s' % branch])
コード例 #7
0
def end_branch(branch, force):
    if branch == get_current_branch_name():
        check_call(['git', 'checkout', 'master'])
    if force:
        check_call(['git', 'branch', '-D', branch])
    else:
        try:
            check_call(['git', 'branch', '-d', branch])
        except subprocess.CalledProcessError:
            log_error("Failed to delete branch %s because it is not fully "
                      "merged (may cause commits loss)." % branch)
            answer = ask("Do you want to force to delete it even so? (y/N) ",
                         pattern=r'[nNyY].*',
                         default='n')
            if answer[0] in 'yY':
                check_call(['git', 'branch', '-D', branch])
            else:
                raise

    if does_branch_exist_on_origin(branch):
        check_call(['git', 'push', 'origin', ':%s' % branch])
コード例 #8
0
ファイル: sync.py プロジェクト: wooparadog/codecli
def main(args):
    branch = get_current_branch_name()
    merge_with_base(branch, rebase=args.rebase)