aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArthur Zamarin <arthurzam@gentoo.org>2022-11-19 17:12:54 +0200
committerArthur Zamarin <arthurzam@gentoo.org>2022-11-21 19:47:48 +0200
commit796958efa2be317ea6f412f6299c5ed45c1373b3 (patch)
treefb88b3f39dfc2c9a284a686afd6ff5aedaa39aa3
parenttests/scripts/test_pkgdev_showkw.py: fix NOCOLOR test (diff)
downloadpkgdev-796958efa2be317ea6f412f6299c5ed45c1373b3.tar.gz
pkgdev-796958efa2be317ea6f412f6299c5ed45c1373b3.tar.bz2
pkgdev-796958efa2be317ea6f412f6299c5ed45c1373b3.zip
push: add option `--pull`
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: https://github.com/pkgcore/pkgdev/issues/102 Signed-off-by: Arthur Zamarin <arthurzam@gentoo.org>
-rw-r--r--data/share/bash-completion/completions/pkgdev1
-rw-r--r--data/share/zsh/site-functions/_pkgdev1
-rw-r--r--src/pkgdev/scripts/pkgdev_push.py6
3 files changed, 8 insertions, 0 deletions
diff --git a/data/share/bash-completion/completions/pkgdev b/data/share/bash-completion/completions/pkgdev
index 1408292..9094ab1 100644
--- a/data/share/bash-completion/completions/pkgdev
+++ b/data/share/bash-completion/completions/pkgdev
@@ -134,6 +134,7 @@ _pkgdev() {
subcmd_options="
-A --ask
-n --dry-run
+ --pull
"
COMPREPLY+=($(compgen -W "${subcmd_options}" -- "${cur}"))
diff --git a/data/share/zsh/site-functions/_pkgdev b/data/share/zsh/site-functions/_pkgdev
index f2c95bc..32b927f 100644
--- a/data/share/zsh/site-functions/_pkgdev
+++ b/data/share/zsh/site-functions/_pkgdev
@@ -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)
diff --git a/src/pkgdev/scripts/pkgdev_push.py b/src/pkgdev/scripts/pkgdev_push.py
index d33f8da..facba8d 100644
--- a/src/pkgdev/scripts/pkgdev_push.py
+++ b/src/pkgdev/scripts/pkgdev_push.py
@@ -32,6 +32,9 @@ push_opts.add_argument(
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
@@ -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: