commit: 796958efa2be317ea6f412f6299c5ed45c1373b3
Author: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Sat Nov 19 15:12:54 2022 +0000
Commit: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Mon Nov 21 17:47:48 2022 +0000
URL:
https://gitweb.gentoo.org/proj/pkgcore/pkgdev.git/commit/?id=796958ef
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 <AT> gentoo.org>
data/share/bash-completion/completions/pkgdev | 1 +
data/share/zsh/site-functions/_pkgdev | 1 +
src/pkgdev/scripts/pkgdev_push.py | 6 ++++++
3 files changed, 8 insertions(+)
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: