コード例 #1
0
def do(args, unknown):
    def needs_push(r):
        state = get_remote_status(r)
        return state == "push" or state == "failed" or state == "divergence"
    def needs_pull(r):
        state = get_remote_status(r)
        return state == "push" or state == "failed" or state == "divergence"

    repos = match_repo_args(args.repository, args.all)

    if args.mode == "human":
        for r in repos:
            state = get_remote_status(r)
            if state == "ok":
                std(r, "Synced")
            elif state == "push":
                std(r, "Local version newer, to sync run git push")
            elif state == "pull":
                std(r, "Remote version newer, to sync run git pull")
            elif state == "divergence":
                std(r, "Diverged from remote")
    elif args.mode == "synced":
        [std(r) for r in repos if get_remote_status(r) == "ok"]
    elif args.mode == "push":
        [std(r) for r in repos if needs_push(r)]
    elif args.mode == "pull":
        [std(r) for r in repos if needs_pull(r)]

    return True
コード例 #2
0
def status(repos, show_unchanged, remote, *args):
    """Does git status on all installed repositories """

    ret = True

    for rep in repos:

        # If we are clean, do nothing
        if is_clean(rep) and not show_unchanged:
            continue

        std("git status", rep)

        if remote:
            r_status = get_remote_status(rep)
            if r_status == "failed":
                std("Remote status:", term_colors("red")+"Unknown (network issues)", term_colors("normal"))
            elif r_status == "ok":
                std("Remote status:", term_colors("green")+"Up-to-date", term_colors("normal"))
            elif r_status == "pull":
                std("Remote status:", term_colors("yellow")+"New commits on remote, please pull. ", term_colors("normal"))
            elif r_status == "push":
                std("Remote status:", term_colors("yellow")+"New local commits, please push. ", term_colors("normal"))
            elif r_status == "divergence":
                std("Remote status:", term_colors("red")+"Remote and local versions have diverged. ", term_colors("normal"))

        val = git_status(rep, *args)
        if not val:
            err("Unable to run git status on", rep)
            ret = False

    return ret
コード例 #3
0
 def needs_updating(rep):
     rep = match_repo(rep, abs=True)
     if verbose:
         return True
     state = get_remote_status(rep)
     return state == "pull" or state == "failed" or state == "divergence"
コード例 #4
0
ファイル: push.py プロジェクト: KWARC/localmh
 def needs_updating(rep):
     state = get_remote_status(rep)
     return state == "push" or state == "failed" or state == "divergence"
コード例 #5
0
ファイル: pull.py プロジェクト: KWARC/localmh
 def needs_updating(rep):
     rep = match_repo(rep, abs=True)
     if verbose:
         return True
     state = get_remote_status(rep)
     return state == "pull" or state == "failed" or state == "divergence"
コード例 #6
0
 def needs_push(r):
     state = get_remote_status(r)
     return state == "push" or state == "failed" or state == "divergence"