def pull_request(message=None, base=GIT_DEFAULT_BASE): print(cyan("Sending pull request to %s/%s." % (GIT_REMOTE_NAME, base))) if confirm(green('Default message: %s' % get_commit_message(message=message))): title = get_commit_message(message=message) else: title = get_commit_message(message=prompt(green("Enter message: "))) data = { "title": title, "body": "", "head": "{user}:{branch}".format(user=GITHUB['user'], branch=get_branch_name()), "base": base } response = post(url=GITHUB['urls']['pull_request'], data=json.dumps(data)) if response.status_code == 201: print(cyan("Pull Request was sent to %s/%s." % (GIT_REMOTE_NAME, base))) elif response.status_code == 422: print(cyan("Pull-request was sent before.")) else: print(response)
def push(force=False, need_rebase=False): if need_rebase: rebase() print(cyan("Pushing...")) if UPSTREAM_ONLY: command = 'git push upstream %s:master' % get_branch_name() else: command = 'git push origin %s' % get_branch_name() # Check if force commit is necessary if force: command += " --force" local(command) print(cyan("Pushed."))
def change(number, prefix=TASK_PREFIX): with quiet(): local("git branch %s%s" % (prefix, number)) local("git checkout %s%s" % (prefix, number)) print(cyan("Changed to %s." % get_branch_name())) if confirm(green("Do you want to reset current branch?")): reset() print(cyan("Got last changes from upstream."))
def push(force=False, need_rebase=False, base=GIT_DEFAULT_BASE): if need_rebase: rebase() print(cyan("Pushing...")) if UPSTREAM_ONLY: command = 'git push %s %s:%s' % ( GIT_REMOTE_NAME, get_branch_name(), base) else: command = 'git push origin %s' % get_branch_name() # Check if force commit is necessary if force: command += " --force" local(command) print(cyan("Pushed."))
def change(number, branch_format_string=BRANCH_FORMAT_STRING, base=GIT_DEFAULT_BASE): with quiet(): branch_name = branch_format_string.format( datetime=datetime.now(), branch_name=number) local("git branch %s" % branch_name) local("git checkout %s" % branch_name) print(cyan("Changed to %s." % get_branch_name())) if confirm(green("Do you want to reset current branch?")): reset(base=base) print(cyan("Got last changes from %s." % GIT_REMOTE_NAME))
def pull_request(message=None): print(cyan("Sending pull request...")) if confirm(green('Default message: %s' % get_commit_message(message=message))): title = get_commit_message(message=message) else: title = get_commit_message(message=prompt(green("Enter message: "))) data = { "title": title, "body": "", "head": "{user}:{branch}".format(user=GITHUB['user'], branch=get_branch_name()), "base": "master" } response = post(url=GITHUB['urls']['pull_request'], data=json.dumps(data)) print(cyan(response) if response.status_code != 201 else cyan("Pull Request was sent."))