Exemple #1
0
def open_editor(content):
    editor_ = editor()

    handle, filename = tempfile.mkstemp(".md")
    os.close(handle)

    with open(filename, "w") as fh:
        fh.write(content)

    try:
        run(*(editor_ + [filename]))

        with open(filename, "r") as fh:
            return fh.read()

    finally:
        os.remove(filename)
Exemple #2
0
def tag(name, push=True):
    run("git", "tag", name, capture=False)

    if push:
        run("git", "push", "origin", name)
Exemple #3
0
def get_change_summary(start, end):
    changes = run("git", "log", "--format=%s", f"{start}..{end}").split("\n")
    list(filter(None, changes))
    return changes
Exemple #4
0
def tags():
    return run("git", "tag", "--list", "--sort=-creatordate").split("\n")
Exemple #5
0
def fetch_tags():
    run("git", "fetch", "--tags")
Exemple #6
0
def repo_name(remote="origin"):
    origin = run("git", "config", "--get", f"remote.{remote}.url")
    return origin.split(":")[1].rsplit(".")[0]
Exemple #7
0
def root():
    return run("git", "rev-parse", "--show-toplevel").strip()
Exemple #8
0
def editor():
    return run("git", "config", "--get", "core.editor").strip().split(" ")