def branch_is_exist(branch_name): # git rev-parse --verify <branch_name> # 返回值等于0的时候存在. 和下面命令等价 command = "git show-ref --verify --quiet refs/heads/" + branch_name try: subprocess_check_run(command) return True except: return False
def test_subprocess_check_run(self): cli.subprocess_check_run('ls')
def git_tag(tag): subprocess_check_run("git tag -a " + tag) return
def delete_branch(branch): subprocess_check_run("git branch -d " + branch)
def checkout(branch): subprocess_check_run("git checkout " + branch)
def diff(): # todo: implement the diff ''' :return: ''' subprocess_check_run('git diff')
def tag(tag_name): subprocess_check_run("git tag -a " + tag_name) return