From patchwork Fri Sep 29 08:34:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavan Nikhilesh Bhagavatula X-Patchwork-Id: 132190 Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id E65E142671; Fri, 29 Sep 2023 10:35:33 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E014E402E7; Fri, 29 Sep 2023 10:35:33 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id D95BD402E6 for ; Fri, 29 Sep 2023 10:35:31 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 38T273XA031700; Fri, 29 Sep 2023 01:35:29 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=yl3sd625AriMvvdsXO/GmAgPl4fIO2CEoaGZxumgH4c=; b=LRmZECENeQFfR8aw6RP07YqFXvzntdN9paSOuuCm/7/JPZOwGdJ/bPoYM30apezwAjKg RX1aHEv/fMFfyjWQgfSZxJzKqks7X+ogwCfT5irdQjBsVmCctm+j4Bj5+/O5gowHu+xx fok+SlJTCkGs9mMiOyZ5SGnFsyHk54Fo8OXwqZ1TwfPbrnwz8lqokzu5o9ShzU5rkE95 Qe0oP43Wv/Up4ym62g+6GeO2Lxer8MZbRPXfxF5NOuhQPqXA4uI4YZ8OKnWL99aaQFPb Kj/hIAQ0ynH6lDSEBXSM8yod2TBCE/BcZxif6QHPVFSIyLKIlpyE9vZLSDg3ijodwRhF Xg== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3td7y6vgek-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Fri, 29 Sep 2023 01:35:27 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Fri, 29 Sep 2023 01:34:51 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Fri, 29 Sep 2023 01:34:51 -0700 Received: from MININT-80QBFE8.corp.innovium.com (MININT-80QBFE8.marvell.com [10.28.164.106]) by maili.marvell.com (Postfix) with ESMTP id 102EA3F7073; Fri, 29 Sep 2023 01:34:48 -0700 (PDT) From: To: , , CC: , Pavan Nikhilesh Subject: [PATCH] pw_maintainers_cli: enhance tree selection Date: Fri, 29 Sep 2023 14:04:43 +0530 Message-ID: <20230929083443.9925-1-pbhagavatula@marvell.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: heITfEAuwDCzYaQqRvZTs9PcCv2VKjsL X-Proofpoint-GUID: heITfEAuwDCzYaQqRvZTs9PcCv2VKjsL X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.980,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-09-29_07,2023-09-28_03,2023-05-22_02 X-BeenThere: ci@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK CI discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ci-bounces@dpdk.org From: Pavan Nikhilesh When longest prefix match doesnt find a suitable tree, pick the tree which has the highest modified file count instead of defauting to main tree. Signed-off-by: Pavan Nikhilesh --- tools/pw_maintainers_cli.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tools/pw_maintainers_cli.py b/tools/pw_maintainers_cli.py index c7b5ba0..4aa46ae 100755 --- a/tools/pw_maintainers_cli.py +++ b/tools/pw_maintainers_cli.py @@ -46,6 +46,7 @@ import re import argparse import fnmatch +from collections import Counter from requests.exceptions import HTTPError from git_pw import config @@ -276,6 +277,7 @@ class Maintainers(object): dpdk-next-crypto + dpdk-next-virtio = dpdk dpdk-next-net-intel + dpdk-next-net-mlx = dpdk-next-net """ + highest_tree = Counter(tree_list).most_common(1)[0][0] # Make sure the list is unique. tree_list = list(set(tree_list)) @@ -287,7 +289,9 @@ class Maintainers(object): os.path.commonprefix(_tree_list).rstrip('-').replace( 'dpdk-next-net-virtio', 'dpdk-next-virtio') # There is no 'dpdk-next' named tree. - if common_prefix.endswith('dpdk-next') or common_prefix.endswith('/'): + if common_prefix.endswith('dpdk-next'): + common_prefix = highest_tree + elif common_prefix.endswith('/'): common_prefix = 'git://dpdk.org/dpdk' return common_prefix