예제 #1
0
def commit(msg, verbose, *repos):
    """Commits all installed repositories """

    ret = True

    for rep in repos:
        std("git commit", rep, "", newline=False)
        if verbose or git_do_data(rep, "status", "--porcelain")[0] != "":
            std()
            ret = git_commit(rep, "-a", "-m", msg) and ret
        else:
            std("Ok, nothing to commit. ")
    return ret
예제 #2
0
    def get_log(repo):
        get_format = lambda frm:git_do_data(repo, "log", "--pretty=format:"+frm+"")[0].split("\n")

        hash_short = get_format("%h")
        commit_titles = get_format("%s")
        dates = get_format("%at")
        dates_human = get_format("%ad")
        author_names = get_format("%an")
        author_mails = get_format("%ae")

        res = [{
                "hash": hash_short[i],
                "subject": commit_titles[i],
                "date": int(dates[i]),
                "date_human": dates_human[i],
                "author": author_names[i],
                "author_mail": author_mails[i],
                "repo": match_repo(repo)
        } for i in range(len(hash_short))]

        return res
예제 #3
0
def is_clean(repo):
    """Checks if a working directory is clean. """
    return git_do_data(repo, "status", "--porcelain")[0] == ""