Ejemplo n.º 1
0
Archivo: Start.py Proyecto: rec/grit
def start(branch, directory=""):
    branches = Git.branches()
    if branch in branches:
        raise ValueError(_ERROR % (branch, " ".join(branches)))

    directory = clone(directory)
    Call.call_raw("git checkout -b " + branch, cwd=directory)
    banner("Checked out new branch", branch)
Ejemplo n.º 2
0
Archivo: Swap.py Proyecto: rec/grit
def swap(a, b):
    missing = set((a, b)) - set(Git.branches())
    if missing:
        raise Exception("Non-existent branch%s: %s" % ("" if len(missing) == 1 else "es", " ".join(missing)))

    temp = a + "-" + b
    rename(a, temp)
    rename(b, a)
    rename(temp, b)
Ejemplo n.º 3
0
Archivo: Rename.py Proyecto: rec/grit
def rename(old, new=None):
    if not new:
        old, new = Git.branch(), old
    if new in Git.branches():
        if not ARGS.force:
            raise Exception('The branch %s already exists.' % new)
        Delete.delete(new)
    Fresh.fresh(new, old)
    Delete.delete(old)