{"id":10742,"url":"https://patchwork.libcamera.org/api/1.1/patches/10742/?format=json","web_url":"https://patchwork.libcamera.org/patch/10742/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20201224122855.22200-7-laurent.pinchart@ideasonboard.com>","date":"2020-12-24T12:28:53","name":"[libcamera-devel,6/8] utils: checkstyle.py: Move diff parsing to Commit class","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"f8a88591a90cc53687fc36587f19a5bbbb7061aa","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/1.1/people/2/?format=json","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"delegate":{"id":14,"url":"https://patchwork.libcamera.org/api/1.1/users/14/?format=json","username":"pinchartl","first_name":"Laurent","last_name":"Pinchart","email":"laurent.pinchart@ideasonboard.com"},"mbox":"https://patchwork.libcamera.org/patch/10742/mbox/","series":[{"id":1550,"url":"https://patchwork.libcamera.org/api/1.1/series/1550/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1550","date":"2020-12-24T12:28:47","name":"checkstyle.py: Ensure meson.build is updated when adding header","version":1,"mbox":"https://patchwork.libcamera.org/series/1550/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/10742/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/10742/checks/","tags":{},"headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 3857AC0F1A\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 24 Dec 2020 12:29:15 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id E594561FF3;\n\tThu, 24 Dec 2020 13:29:14 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 0A5EA615B0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 24 Dec 2020 13:29:10 +0100 (CET)","from pendragon.lan (62-78-145-57.bb.dnainternet.fi [62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 978B1A1D\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 24 Dec 2020 13:29:09 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"wK0U1oyW\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1608812949;\n\tbh=842OaJz8aXP5QHYae35b2PfuGuUyo05f13sH0nuiqjI=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=wK0U1oyW8/AUsY2492T8+HP7mu3hzY2iSxu89UqfzazHvjgaPY2FiNYuMa6HllTB1\n\tEK1XoHP2nYRbt2m9K5BCLadtKomw6gK4sCBiTGD2jXLxjxBinc0lhsnkCakuZZ9kuy\n\t4rLOfvKkLckPbJX8s+viNXuYJVIaxGy0IeTr2OEA=","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Thu, 24 Dec 2020 14:28:53 +0200","Message-Id":"<20201224122855.22200-7-laurent.pinchart@ideasonboard.com>","X-Mailer":"git-send-email 2.27.0","In-Reply-To":"<20201224122855.22200-1-laurent.pinchart@ideasonboard.com>","References":"<20201224122855.22200-1-laurent.pinchart@ideasonboard.com>","MIME-Version":"1.0","Subject":"[libcamera-devel] [PATCH 6/8] utils: checkstyle.py: Move diff\n\tparsing to Commit class","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"To avoid duplicating diff parsing in commit checkers, move it to the\nCommit class.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n utils/checkstyle.py | 13 +++++++------\n 1 file changed, 7 insertions(+), 6 deletions(-)","diff":"diff --git a/utils/checkstyle.py b/utils/checkstyle.py\nindex 07e896d9819f..9c2a1837aa11 100755\n--- a/utils/checkstyle.py\n+++ b/utils/checkstyle.py\n@@ -236,9 +236,10 @@ class Commit:\n         return self.__title\n \n     def get_diff(self, top_level, filename):\n-        return subprocess.run(['git', 'diff', '%s~..%s' % (self.commit, self.commit),\n+        diff = subprocess.run(['git', 'diff', '%s~..%s' % (self.commit, self.commit),\n                                '--', '%s/%s' % (top_level, filename)],\n                               stdout=subprocess.PIPE).stdout.decode('utf-8')\n+        return parse_diff(diff.splitlines(True))\n \n     def get_file(self, filename):\n         return subprocess.run(['git', 'show', '%s:%s' % (self.commit, filename)],\n@@ -256,9 +257,10 @@ class StagedChanges(Commit):\n         self.__files = [CommitFile(f) for f in ret.splitlines()]\n \n     def get_diff(self, top_level, filename):\n-        return subprocess.run(['git', 'diff', '--staged', '--',\n+        diff = subprocess.run(['git', 'diff', '--staged', '--',\n                                '%s/%s' % (top_level, filename)],\n                               stdout=subprocess.PIPE).stdout.decode('utf-8')\n+        return parse_diff(diff.splitlines(True))\n \n \n class Amendment(StagedChanges):\n@@ -276,9 +278,10 @@ class Amendment(StagedChanges):\n         self.__files = [CommitFile(f) for f in ret.splitlines()]\n \n     def get_diff(self, top_level, filename):\n-        return subprocess.run(['git', 'diff', '--staged', 'HEAD~', '--',\n+        diff = subprocess.run(['git', 'diff', '--staged', 'HEAD~', '--',\n                                '%s/%s' % (top_level, filename)],\n                               stdout=subprocess.PIPE).stdout.decode('utf-8')\n+        return parse_diff(diff.splitlines(True))\n \n \n # ------------------------------------------------------------------------------\n@@ -657,9 +660,7 @@ class StripTrailingSpaceFormatter(Formatter):\n \n def check_file(top_level, commit, filename):\n     # Extract the line numbers touched by the commit.\n-    diff = commit.get_diff(top_level, filename)\n-    diff = diff.splitlines(True)\n-    commit_diff = parse_diff(diff)\n+    commit_diff = commit.get_diff(top_level, filename)\n \n     lines = []\n     for hunk in commit_diff:\n","prefixes":["libcamera-devel","6/8"]}