Esempio n. 1
0
def get_lines_edited(promise_commit_hash, file_name):
    command = "git diff --staged --unified=0 %s %s" % (promise_commit_hash,
                                                       file_name)
    output = sb.call(command).split('\n')
    a1 = [el.split() for el in output if el[:2] == "@@"]
    a2 = [el[1][1:] for el in a1]
    return a2
Esempio n. 2
0
def branch_exists(branch_name):
    git_exists_with_name = "git rev-parse --verify --quiet " + branch_name
    output = sb.call(git_exists_with_name)
    if output == "":
        return False
    else:
        return True
Esempio n. 3
0
def checkout(branch_name):
    command = "git checkout " + branch_name
    sb.call(command)
Esempio n. 4
0
def delete_branch(branch_name):
    command = "git branch -D " + branch_name
    sb.call(command)
Esempio n. 5
0
def merge(branch_name):
    command = "git merge " + branch_name
    sb.call(command)
Esempio n. 6
0
def is_staged(file_name):
    command = "git diff --name-only --cached"
    staged_files = sb.call(command).split()
    if file_name in staged_files:
        return True
    return False
Esempio n. 7
0
def commit_with_args(args):
    command = ["git"] + ["commit"] + args
    sb.call(command)
Esempio n. 8
0
def current_branch():
    command = "git branch"
    name = next(branch_name for branch_name in sb.call(command).split("\n")
                if branch_name[0] == "*")
    return name.split(" ")[1]
Esempio n. 9
0
def commit(commit_message):
    command = "git commit -m".split() + ["\"" + commit_message + "\""]
    sb.call(command)
Esempio n. 10
0
def current_hash():
    hash_command = "git rev-parse HEAD"
    hash_str = sb.call(hash_command).split("\n")[0]
    return hash_str
Esempio n. 11
0
def add(file_name):
    command = "git add " + file_name
    sb.call(command)
Esempio n. 12
0
def init():
    command = "git init"
    sb.call(command)
Esempio n. 13
0
def branch(branch_name):
    command = "git branch " + branch_name
    sb.call(command)