Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

push: add option --pull #105

Merged
merged 1 commit into from
Nov 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions data/share/bash-completion/completions/pkgdev
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ _pkgdev() {
subcmd_options="
-A --ask
-n --dry-run
--pull
"

COMPREPLY+=($(compgen -W "${subcmd_options}" -- "${cur}"))
Expand Down
1 change: 1 addition & 0 deletions data/share/zsh/site-functions/_pkgdev
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ case $state in
$base_options \
{'(--ask)-A','(-A)--ask'}'[confirm pushing commits with QA errors]' \
{'(--dry-run)-n','(-n)--dry-run'}'[pretend to push commits]' \
'--pull[run git pull --rebase before scanning]' \
&& ret=0
;;
(showkw)
Expand Down
6 changes: 6 additions & 0 deletions src/pkgdev/scripts/pkgdev_push.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ def parse_known_args(self, args=None, namespace=None):
push_opts.add_argument(
'-n', '--dry-run', action='store_true',
help='pretend to push the commits')
push_opts.add_argument(
'--pull', action='store_true',
help='run `git pull --rebase` before scanning')


@push.bind_final_check
Expand All @@ -45,6 +48,9 @@ def _commit_validate(parser, namespace):

@push.bind_main_func
def _push(options, out, err):
if options.pull:
git.run('pull', '--rebase', cwd=options.repo.location)

# scan commits for QA issues
pipe = scan(options.scan_args)
with reporters.FancyReporter(out) as reporter:
Expand Down