From patchwork Sat Nov 16 16:16:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konstantin Ryabitsev X-Patchwork-Id: 1196150 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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 47Fj7b5W2wz9sPF for ; Sun, 17 Nov 2019 04:36:27 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=linuxfoundation.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="NViTydl9"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 47Fj7Z05vDzDrj8 for ; Sun, 17 Nov 2019 04:36:26 +1100 (AEDT) X-Original-To: patchwork@lists.ozlabs.org Delivered-To: patchwork@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=linuxfoundation.org (client-ip=2607:f8b0:4864:20::843; helo=mail-qt1-x843.google.com; envelope-from=konstantin@linuxfoundation.org; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linuxfoundation.org Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="NViTydl9"; dkim-atps=neutral Received: from mail-qt1-x843.google.com (mail-qt1-x843.google.com [IPv6:2607:f8b0:4864:20::843]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 47FgLz4MjhzDqbq for ; Sun, 17 Nov 2019 03:16:11 +1100 (AEDT) Received: by mail-qt1-x843.google.com with SMTP id j5so13155879qtn.10 for ; Sat, 16 Nov 2019 08:16:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-disposition:in-reply-to; bh=BRj5xWKrL6nSdi85GN/io4m7dvv5WUHoeiGk/aYPYio=; b=NViTydl9ihDg9lj4EOmmHl6Jrn+F4b/tBYFaXrjqo/dtzTvIAnmGdJSLimWY16yC14 exrnzaNNKbJGLQ+kchCK1wvYjhoM1HTZQobLMIIzTtCue4Bof6hSD6a4MFjvOTE0OmeS iFzZ1TEPijFLY7Mgi/pS5BylIhWLtC5tt6Fw8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :in-reply-to; bh=BRj5xWKrL6nSdi85GN/io4m7dvv5WUHoeiGk/aYPYio=; b=LeGZOH4k2rdUy687Fvn45/319KUlNrgYOy219eamV1RhJhxGjUZCdSCboAZ/zL/U/p 1zGoPikXzYP5QkBOgOG6J7i5ROwQWib7RMtu/NO/ZeEIT8CNqVagUtl48a9und4LGqgL zqtL0abVr1Z8gyIZfSIdUbfR4yFDTGw3or3dXU+/Qeo222lyITnfA5evqv2zvS+7anXw yc6eKxWqFWC4cVPWASwydn2TZsf9dhi82IEFJ7ceNn1UKnqjYoYNNcHWfuZnFkW5dBi5 OwfV5aENtA/y532BwE6jFSZL8YLF0TH/6LISW2rsIzWfE70/f0haR5btLNlKWDgt/nno ltaQ== X-Gm-Message-State: APjAAAXFzNxHaaSsr5S2Q0M2yhb+I23+JgwLCnnoZmYOK7x324fImJnH kFdNML+57mF1r82wta6ejYQ1dVTDTWv1NA== X-Google-Smtp-Source: APXvYqzEnEkIAremLZsFFE1EZYG+SbFiGiKv12IIo9UbmBgf59xyQpSuRCB4f+siqi7ZL24NHSCVbQ== X-Received: by 2002:ac8:6d31:: with SMTP id r17mr19294772qtu.28.1573920963063; Sat, 16 Nov 2019 08:16:03 -0800 (PST) Received: from chatter.i7.local (107-179-243-71.cpe.teksavvy.com. [107.179.243.71]) by smtp.gmail.com with ESMTPSA id y10sm5924599qkb.55.2019.11.16.08.16.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Nov 2019 08:16:02 -0800 (PST) Date: Sat, 16 Nov 2019 11:16:00 -0500 From: Konstantin Ryabitsev To: patchwork@lists.ozlabs.org Subject: [PATCH v2] Improve pull request URL matching regex Message-ID: <20191116161600.tktwrbe6tllb3e4r@chatter.i7.local> Mail-Followup-To: patchwork@lists.ozlabs.org, Andrew Donnellan References: <89ef050b-5b75-cb3b-8219-9195f089f53a@linux.ibm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <89ef050b-5b75-cb3b-8219-9195f089f53a@linux.ibm.com> X-BeenThere: patchwork@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Patchwork development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrew Donnellan Errors-To: patchwork-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Patchwork" When git-request-pull output is pasted into a mail client instead of mailed directly, the ref part of the pull URL may end up wrapped to the next line. Example: https://lore.kernel.org/r/294422a4-37b2-def5-5d32-8988f27c3a5b@gmail.com/ This change properly parses URLs both with and without newlines. Signed-off-by: Konstantin Ryabitsev Reviewed-by: Andrew Donnellan Reviewed-by: Stephen Finucane --- patchwork/parser.py | 4 +- .../0023-git-pull-request-newline-in-url.mbox | 48 +++++++++++++++++++ patchwork/tests/test_parser.py | 9 ++++ 3 files changed, 59 insertions(+), 2 deletions(-) create mode 100644 patchwork/tests/mail/0023-git-pull-request-newline-in-url.mbox base-commit: 239fbd2ca1bf140bc61fdee922944624b23c812c diff --git a/patchwork/parser.py b/patchwork/parser.py index c794f09..d25c0df 100644 --- a/patchwork/parser.py +++ b/patchwork/parser.py @@ -939,11 +939,11 @@ def parse_patch(content): def parse_pull_request(content): git_re = re.compile(r'^The following changes since commit.*' r'^are available in the git repository at:\n' - r'^\s*([\S]+://[^\n]+)$', + r'^\s*([\w+-]+(?:://|@)[\w/.@:~-]+[\s\\]*[\w/._-]*)\s*$', re.DOTALL | re.MULTILINE | re.IGNORECASE) match = git_re.search(content) if match: - return match.group(1) + return re.sub('\s+', ' ', match.group(1)).strip() return None diff --git a/patchwork/tests/mail/0023-git-pull-request-newline-in-url.mbox b/patchwork/tests/mail/0023-git-pull-request-newline-in-url.mbox new file mode 100644 index 0000000..74c29ce --- /dev/null +++ b/patchwork/tests/mail/0023-git-pull-request-newline-in-url.mbox @@ -0,0 +1,48 @@ +From mboxrd@z Thu Jan 1 00:00:00 1970 +To: soc@kernel.org +From: Matthias Brugger +Subject: [GIT PULL] soc: updates for v5.5 +Message-ID: <294422a4-37b2-def5-5d32-8988f27c3a5b@gmail.com> +Date: Mon, 11 Nov 2019 13:23:51 +0100 + +Hi Olof and Arnd, + +Please have a look on the following updates of drivers/soc for v5.5 + +Thanks a lot, +Matthias + +--- + +The following changes since commit 54ecb8f7028c5eb3d740bb82b0f1d90f2df63c5c: + + Linux 5.4-rc1 (2019-09-30 10:35:40 -0700) + +are available in the Git repository at: + + https://git.kernel.org/pub/scm/linux/kernel/git/matthias.bgg/linux.git/ +tags/v5.4-next-soc + +for you to fetch changes up to 662c9d55c5ccb37f3920ecab9720f2ebf2a6ca18: + + soc: mediatek: Refactor bus protection control (2019-11-07 10:11:04 +0100) + +---------------------------------------------------------------- +refactor code of mtk-scpsys + +---------------------------------------------------------------- +Weiyi Lu (5): + soc: mediatek: Refactor polling timeout and documentation + soc: mediatek: Refactor regulator control + soc: mediatek: Refactor clock control + soc: mediatek: Refactor sram control + soc: mediatek: Refactor bus protection control + + drivers/soc/mediatek/mtk-scpsys.c | 214 ++++++++++++++++++++++++++------------ + 1 file changed, 146 insertions(+), 68 deletions(-) + +_______________________________________________ +linux-arm-kernel mailing list +linux-arm-kernel@lists.infradead.org +http://lists.infradead.org/mailman/listinfo/linux-arm-kernel + diff --git a/patchwork/tests/test_parser.py b/patchwork/tests/test_parser.py index 85c6c52..0bf7158 100644 --- a/patchwork/tests/test_parser.py +++ b/patchwork/tests/test_parser.py @@ -630,6 +630,15 @@ class PatchParseTest(PatchTest): diff.startswith('diff --git a/arch/x86/include/asm/smp.h'), diff) + def test_git_pull_newline_in_url(self): + diff, message = self._find_content( + '0023-git-pull-request-newline-in-url.mbox') + pull_url = parse_pull_request(message) + self.assertEqual( + 'https://git.kernel.org/pub/scm/linux/kernel/git/matthias.bgg/' + 'linux.git/ tags/v5.4-next-soc', + pull_url) + def test_git_rename(self): diff, _ = self._find_content('0008-git-rename.mbox') self.assertTrue(diff is not None)