From patchwork Tue Jul 31 06:38:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Donnellan X-Patchwork-Id: 951427 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41fmx23fZJz9ryn for ; Tue, 31 Jul 2018 16:38:46 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=au1.ibm.com Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 41fmx22PR9zF15Z for ; Tue, 31 Jul 2018 16:38:46 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=au1.ibm.com X-Original-To: snowpatch@lists.ozlabs.org Delivered-To: snowpatch@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=au1.ibm.com (client-ip=148.163.156.1; helo=mx0a-001b2d01.pphosted.com; envelope-from=andrew.donnellan@au1.ibm.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=au1.ibm.com Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 41fmwx4x6SzF14l for ; Tue, 31 Jul 2018 16:38:41 +1000 (AEST) Received: from pps.filterd (m0098393.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w6V6TZ5R112024 for ; Tue, 31 Jul 2018 02:38:39 -0400 Received: from e06smtp04.uk.ibm.com (e06smtp04.uk.ibm.com [195.75.94.100]) by mx0a-001b2d01.pphosted.com with ESMTP id 2kjfrd5uud-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 31 Jul 2018 02:38:38 -0400 Received: from localhost by e06smtp04.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 31 Jul 2018 07:38:36 +0100 Received: from b06cxnps4076.portsmouth.uk.ibm.com (9.149.109.198) by e06smtp04.uk.ibm.com (192.168.101.134) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Tue, 31 Jul 2018 07:38:33 +0100 Received: from d06av24.portsmouth.uk.ibm.com (mk.ibm.com [9.149.105.60]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w6V6cWwV42401928 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 31 Jul 2018 06:38:32 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B6B224204D; Tue, 31 Jul 2018 09:38:44 +0100 (BST) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 649F342045; Tue, 31 Jul 2018 09:38:44 +0100 (BST) Received: from ozlabs.au.ibm.com (unknown [9.192.253.14]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 31 Jul 2018 09:38:44 +0100 (BST) Received: from intelligence.ozlabs.ibm.com (haven.au.ibm.com [9.192.254.114]) (using TLSv1.2 with cipher DHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.au.ibm.com (Postfix) with ESMTPSA id 04143A0138; Tue, 31 Jul 2018 16:38:30 +1000 (AEST) From: Andrew Donnellan To: snowpatch@lists.ozlabs.org Date: Tue, 31 Jul 2018 16:38:17 +1000 X-Mailer: git-send-email 2.11.0 X-TM-AS-GCONF: 00 x-cbid: 18073106-0016-0000-0000-000001EE90BE X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18073106-0017-0000-0000-00003243AE2C Message-Id: <20180731063817.13186-1-andrew.donnellan@au1.ibm.com> MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-07-31_03:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1806210000 definitions=main-1807310071 Subject: [snowpatch] [PATCH] Fix --series option X-BeenThere: snowpatch@lists.ozlabs.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: Continuous Integration for patch-based workflows List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: snowpatch-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "snowpatch" Somewhere along the way, we completely broke the --series option and failed to notice. It appears we try to retrieve a Project over the Patchwork API and pass an entirely invalid URL. As it turns out we can just use the Project already retrieved as part of the Patch that we already retrieve, so use that instead. (This is why we need tests, which we ironically don't yet have...) Reported-by: Russell Currey Closes: #43 ("Fix --series") Signed-off-by: Andrew Donnellan --- src/main.rs | 6 ++---- src/patchwork.rs | 4 ---- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/src/main.rs b/src/main.rs index eb7ffc1ee36d..3102cf82e972 100644 --- a/src/main.rs +++ b/src/main.rs @@ -370,10 +370,8 @@ fn main() { let patch = patchwork .get_patch_by_url(&series.patches.last().unwrap().url) .unwrap(); - // We have to do it this way since there's no project field on Series - let project = patchwork.get_project(&patch.project.name).unwrap(); - match settings.projects.get(&project.link_name) { - None => panic!("Couldn't find project {}", &project.link_name), + match settings.projects.get(&patch.project.link_name) { + None => panic!("Couldn't find project {}", &patch.project.link_name), Some(project) => { let dependencies = patchwork.get_patch_dependencies(&patch); let mbox = patchwork.get_patches_mbox(dependencies); diff --git a/src/patchwork.rs b/src/patchwork.rs index 378c6ca9de70..c9c335472496 100644 --- a/src/patchwork.rs +++ b/src/patchwork.rs @@ -284,10 +284,6 @@ impl PatchworkServer { Ok(resp.status()) } - pub fn get_project(&self, url: &str) -> Result { - serde_json::from_str(&self.get_url_string(url).unwrap()) - } - pub fn get_patch(&self, patch_id: &u64) -> Result { let url = format!( "{}{}/patches/{}{}",