From patchwork Wed Apr 13 11:12:21 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dirk Wallenstein X-Patchwork-Id: 90985 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from ozlabs.org (localhost [IPv6:::1]) by ozlabs.org (Postfix) with ESMTP id ED9A81007D7 for ; Wed, 13 Apr 2011 21:12:34 +1000 (EST) Received: from mailout02.t-online.de (mailout02.t-online.de [194.25.134.17]) by ozlabs.org (Postfix) with ESMTP id 094B6B6F76 for ; Wed, 13 Apr 2011 21:12:31 +1000 (EST) Received: from fwd07.aul.t-online.de (fwd07.aul.t-online.de ) by mailout02.t-online.de with smtp id 1Q9xzv-0000er-C0; Wed, 13 Apr 2011 13:12:35 +0200 Received: from localhost (GQiZNgZLohDJl3sJr36IdLRTD49OM4+G+Ut4GbCNpACICVzoYyI2BmEi7wNvTofQhh@[84.139.67.180]) by fwd07.t-online.de with esmtp id 1Q9xzg-15gEKG0; Wed, 13 Apr 2011 13:12:20 +0200 Date: Wed, 13 Apr 2011 13:12:21 +0200 From: Dirk Wallenstein To: Jeremy Kerr Subject: [PATCH v2] Ensure consecutive patch header lines Message-ID: <20110413111221.GA21237@bottich> References: <20110209193505.GA11850@zap> <201102280929.13808.jk@ozlabs.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <201102280929.13808.jk@ozlabs.org> User-Agent: Mutt/1.5.20 (2009-06-14) X-ID: GQiZNgZLohDJl3sJr36IdLRTD49OM4+G+Ut4GbCNpACICVzoYyI2BmEi7wNvTofQhh X-TOI-MSGID: f73ab3ff-2409-4b4f-be1a-9b6e0321fd79 Cc: patchwork@lists.ozlabs.org X-BeenThere: patchwork@lists.ozlabs.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Patchwork development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: patchwork-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: patchwork-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Drop the parse buffer if the start of a new diff is encountered in state 1. Signed-off-by: Dirk Wallenstein --- v2: On Mon, Feb 28, 2011 at 09:29:13AM +0800, Jeremy Kerr wrote: > I think a nicer fix would be to drop the current parse buffer (ie, make it > part of the comment) if we see '^diff' again, rather than allowing for only > one line between '^diff' and '^--- '. This way we should only see entire hunks > ending up in the patch bufffer. Sorry for the holdup. I lost this TODO somewhere. apps/patchwork/parser.py | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/apps/patchwork/parser.py b/apps/patchwork/parser.py index 2b5e9a0..a432f4f 100644 --- a/apps/patchwork/parser.py +++ b/apps/patchwork/parser.py @@ -81,6 +81,11 @@ def parse_patch(text): commentbuf += line elif state == 1: + if line.startswith('diff') or line.startswith('===') \ + or line.startswith('Index: '): + commentbuf += buf + buf = '' + buf += line if line.startswith('--- '): state = 2