From e6af65c5f3a315f69ccd46b3043a608b9463acce Mon Sep 17 00:00:00 2001 From: anorth Date: Thu, 16 Jan 2020 15:31:51 -0800 Subject: [PATCH] Set upstream on push, and use --force-with-lease --- gflow.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/gflow.py b/gflow.py index 1e60f57..5c19145 100755 --- a/gflow.py +++ b/gflow.py @@ -25,6 +25,7 @@ Upcoming features fixes: +- add --help option to describe commands - add squash option to land - add delete branch/s option to land - count the diff stat size and append a description to PR title @@ -126,7 +127,7 @@ def do_publish(self, *args): if source == 'master': raise FlowError("Refusing to publish master branch, use git push directly.") - self._push(source, pargs.no_verify) + self._push(source, no_verify=pargs.no_verify, set_upstream=True) def do_unpublish(self, *args): """ @@ -210,10 +211,12 @@ def do_land(self, *args): def _current_branch(self) -> str: return self._git_cap("rev-parse", "--abbrev-ref", "HEAD").strip() - def _push(self, branch, no_verify=False): - extra_args = ["--force"] + def _push(self, branch, no_verify=False, set_upstream=False): + extra_args = ["--force-with-lease"] if no_verify: extra_args.append("--no-verify") + if set_upstream: + extra_args.append("--set-upstream") return self._git_run("push", "origin", "{0}:{0}".format(branch), *extra_args)