From: Ali Alnubani <alialnu@oss.nvidia.com>
To: <ci@dpdk.org>
Cc: <thomas@monjalon.net>, <jerinj@marvell.com>,
<ferruh.yigit@intel.com>, <david.marchand@redhat.com>,
<juraj.linkes@pantheon.tech>
Subject: [dpdk-ci] [PATCH v3 03/10] tools: update script usage
Date: Mon, 18 Oct 2021 10:44:53 +0300 [thread overview]
Message-ID: <20211018074500.16199-4-alialnu@nvidia.com> (raw)
In-Reply-To: <20211018074500.16199-1-alialnu@nvidia.com>
The resource type (whether it's a patch or a series) is now
specified by the new argument --type.
Both commands: list_trees_for_patch & list_trees_for_series
are replaced by the positional arg 'list_trees', and the type must
be always set.
This makes adding more operations require less arguments.
Signed-off-by: Ali Alnubani <alialnu@nvidia.com>
---
tools/pw_maintainers_cli.py | 32 +++++++++++++++++++++-----------
1 file changed, 21 insertions(+), 11 deletions(-)
diff --git a/tools/pw_maintainers_cli.py b/tools/pw_maintainers_cli.py
index 343e9f5..d4c0056 100755
--- a/tools/pw_maintainers_cli.py
+++ b/tools/pw_maintainers_cli.py
@@ -31,8 +31,8 @@ variables PW_{SERVER,PROJECT,TOKEN} should be set. If not, the script will try
to load the git configurations pw.{server,project,token}.
Example usage:
- ./pw_maintainers_cli.py --command list_trees_for_series 2054
- ./pw_maintainers_cli.py --command list_trees_for_patch 2054
+ ./pw_maintainers_cli.py --type series list_trees 2054
+ ./pw_maintainers_cli.py --type patch list_trees 2054
Or if you want to use inside other scripts:
@@ -238,14 +238,14 @@ if __name__ == '__main__':
"""Main procedure."""
parser = argparse.ArgumentParser()
git_pw_conf_parser = parser.add_argument_group('git-pw configurations')
- options_parser = parser.add_argument_group('optional arguments')
+ required_args_parser = parser.add_argument_group('required arguments')
- options_parser.add_argument(
- '--command',
+ required_args_parser.add_argument(
+ '--type',
choices=(
- 'list_trees_for_patch',
- 'list_trees_for_series'),
- required=True, help='Command to perform')
+ 'patch',
+ 'series'),
+ required=True, help='Resource type.')
git_pw_conf_parser.add_argument(
'--pw_server', type=str,
@@ -262,12 +262,18 @@ if __name__ == '__main__':
default=os.environ.get('PW_TOKEN', utils.git_config('pw.token')),
help='Authentication token')
+ parser.add_argument(
+ 'command',
+ choices=[
+ 'list_trees'],
+ help='Command to perform')
parser.add_argument(
'id', type=int, help='patch/series id')
args = parser.parse_args()
command = args.command
+ resource_type = args.type
_id = args.id
# Pass the needed configurations to git-pw.
@@ -279,9 +285,9 @@ if __name__ == '__main__':
maintainers = Maintainers()
patch_list = []
- if command == 'list_trees_for_patch':
+ if resource_type == 'patch':
patch_list.append(_git_pw.api_get('patches', _id))
- elif command == 'list_trees_for_series':
+ else:
series = _git_pw.api_get('series', _id)
patch_list = [
_git_pw.api_get('patches', patch['id'])
@@ -290,4 +296,8 @@ if __name__ == '__main__':
files = []
for patch in patch_list:
files += Diff.find_filenames(patch['diff'])
- print(maintainers.get_tree(files).split('/')[-1])
+
+ tree = maintainers.get_tree(files)
+
+ if command == 'list_trees':
+ print(tree.split('/')[-1])
--
2.25.1
next prev parent reply other threads:[~2021-10-18 7:46 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-18 7:44 [dpdk-ci] [PATCH v3 00/10] Automatic patchwork delegation Ali Alnubani
2021-10-18 7:44 ` [dpdk-ci] [PATCH v3 01/10] tools: rename guess_git_tree script Ali Alnubani
2021-10-18 7:44 ` [dpdk-ci] [PATCH v3 02/10] tools: match by tree URL instead of tree name Ali Alnubani
2021-10-18 7:44 ` Ali Alnubani [this message]
2021-10-18 7:44 ` [dpdk-ci] [PATCH v3 04/10] tools: add functionality for detecting tree maintainers Ali Alnubani
2021-10-18 7:44 ` [dpdk-ci] [PATCH v3 05/10] tools: add functionality for setting pw delegates Ali Alnubani
2021-10-18 7:44 ` [dpdk-ci] [PATCH v3 06/10] add git-pw to requirements file Ali Alnubani
2021-10-18 7:44 ` [dpdk-ci] [PATCH v3 07/10] tools: filter new Patchwork IDs by date Ali Alnubani
2021-10-18 7:44 ` [dpdk-ci] [PATCH v3 08/10] tools: support fetching series Ali Alnubani
2021-10-18 7:44 ` [dpdk-ci] [PATCH v3 09/10] tools: filter new patchwork IDs by project name Ali Alnubani
2021-10-18 7:45 ` [dpdk-ci] [PATCH v3 10/10] tools: skip the IDs we already fetched Ali Alnubani
2021-10-18 8:06 ` [dpdk-ci] [PATCH v3 00/10] Automatic patchwork delegation Ali Alnubani
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211018074500.16199-4-alialnu@nvidia.com \
--to=alialnu@oss.nvidia.com \
--cc=ci@dpdk.org \
--cc=david.marchand@redhat.com \
--cc=ferruh.yigit@intel.com \
--cc=jerinj@marvell.com \
--cc=juraj.linkes@pantheon.tech \
--cc=thomas@monjalon.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).