示例#1
0
def blender_update_skip(args):
    if make_utils.command_missing(args.git_command):
        sys.stderr.write("git not found, can't update code\n")
        sys.exit(1)

    # Abort if a rebase is still progress.
    rebase_merge = check_output([args.git_command, 'rev-parse', '--git-path', 'rebase-merge'])
    rebase_apply = check_output([args.git_command, 'rev-parse', '--git-path', 'rebase-apply'])
    merge_head = check_output([args.git_command, 'rev-parse', '--git-path', 'MERGE_HEAD'])
    if os.path.exists(rebase_merge) or \
       os.path.exists(rebase_apply) or \
       os.path.exists(merge_head):
        return "rebase or merge in progress, complete it first"

    # Abort if uncommitted changes.
    changes = check_output([args.git_command, 'status', '--porcelain', '--untracked-files=no'])
    if len(changes) != 0:
        return "you have unstaged changes"

    # Test if there is an upstream branch configured
    branch = check_output([args.git_command, "rev-parse", "--abbrev-ref", "HEAD"])
    remote = check_output([args.git_command, "config", "branch." + branch + ".remote"], exit_on_error=False)
    if len(remote) == 0:
        return "no remote branch to pull from"

    return None
示例#2
0
def get_blender_git_root():
    return check_output([args.git_command, "rev-parse", "--show-toplevel"])