Skip to content

Commit 796958e

Browse files
committed
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: #102 Signed-off-by: Arthur Zamarin <[email protected]>
1 parent f9c6971 commit 796958e

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

data/share/bash-completion/completions/pkgdev

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ _pkgdev() {
134134
subcmd_options="
135135
-A --ask
136136
-n --dry-run
137+
--pull
137138
"
138139

139140
COMPREPLY+=($(compgen -W "${subcmd_options}" -- "${cur}"))

data/share/zsh/site-functions/_pkgdev

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ case $state in
7777
$base_options \
7878
{'(--ask)-A','(-A)--ask'}'[confirm pushing commits with QA errors]' \
7979
{'(--dry-run)-n','(-n)--dry-run'}'[pretend to push commits]' \
80+
'--pull[run git pull --rebase before scanning]' \
8081
&& ret=0
8182
;;
8283
(showkw)

src/pkgdev/scripts/pkgdev_push.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ def parse_known_args(self, args=None, namespace=None):
3232
push_opts.add_argument(
3333
'-n', '--dry-run', action='store_true',
3434
help='pretend to push the commits')
35+
push_opts.add_argument(
36+
'--pull', action='store_true',
37+
help='run `git pull --rebase` before scanning')
3538

3639

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

4649
@push.bind_main_func
4750
def _push(options, out, err):
51+
if options.pull:
52+
git.run('pull', '--rebase', cwd=options.repo.location)
53+
4854
# scan commits for QA issues
4955
pipe = scan(options.scan_args)
5056
with reporters.FancyReporter(out) as reporter:

0 commit comments

Comments
 (0)