From patchwork Sat Aug 10 00:58:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 20871 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 24870BE173 for ; Sat, 10 Aug 2024 00:59:12 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id BAD32633C0; Sat, 10 Aug 2024 02:59:11 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="NBdX1VB+"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 80B2563398 for ; Sat, 10 Aug 2024 02:59:07 +0200 (CEST) Received: from pendragon.ideasonboard.com (81-175-209-231.bb.dnainternet.fi [81.175.209.231]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 753E24AB for ; Sat, 10 Aug 2024 02:58:12 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1723251492; bh=Pv76YY4/yvthH5nVweMWTrDdG29zVzp/juhGQSvDS7A=; h=From:To:Subject:Date:In-Reply-To:References:From; b=NBdX1VB+KNQua93+tymcDbW3S4aiEHqCWx3X7wgTqK8v0hpJCvb88QH2qn4dfUN84 OjIPrL/78450ffmVqJpro9RwDIM8VzwJ9dMVo0Aqb8JlogUcs9GmpTTOfmum5SjEaZ vNlWDMFFvH/+ODpEifwv1ymlyCDIem+METRKHhfA= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Subject: [PATCH 3/3] utils: checkstyle.py: Add __repr__ method to Commit class Date: Sat, 10 Aug 2024 03:58:40 +0300 Message-ID: <20240810005840.20841-3-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.44.2 In-Reply-To: <20240810005840.20841-1-laurent.pinchart@ideasonboard.com> References: <20240810005840.20841-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" When debugging issues with the Commit class, a __repr__ method proved to be useful to quickly print all the parsed information about a commit. To avoid reimplementing the method over and over again in the future, add it to the class, even if it is not actually used. Signed-off-by: Laurent Pinchart Reviewed-by: Milan Zamazal Reviewed-by: Daniel Scally --- utils/checkstyle.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/utils/checkstyle.py b/utils/checkstyle.py index 2b1e1f6c1b9e..c9e41d4149f7 100755 --- a/utils/checkstyle.py +++ b/utils/checkstyle.py @@ -248,6 +248,17 @@ class Commit: stdout=subprocess.PIPE).stdout.decode('utf-8') self._files = [CommitFile(f) for f in ret.splitlines()] + def __repr__(self): + return '\n'.join([ + f'commit {self.commit}', + f'Author: {self.author}', + f'', + f' {self.title}', + '', + '\n'.join([line and f' {line}' or '' for line in self._body]), + 'Trailers:', + ] + self.trailers) + def files(self, filter='AMR'): return [f.filename for f in self._files if f.status in filter]