Skip to content

Commit

Permalink
push: add option --pull
Browse files Browse the repository at this point in the history
Add a new option `--pull` to `pkgdev push` to pull all changes before
starting the scan & push. This is very useful for most normal usage for
developers.

This can be also set in config, but adding the line:

    push.pull =

Resolves: #102
Signed-off-by: Arthur Zamarin <arthurzam@gentoo.org>
  • Loading branch information
arthurzam committed Nov 21, 2022
1 parent f9c6971 commit 796958e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
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

0 comments on commit 796958e

Please sign in to comment.