Patch Detail
Show a patch.
GET /api/patches/56/?format=api
{ "id": 56, "url": "https://patchwork.libcamera.org/api/patches/56/?format=api", "web_url": "https://patchwork.libcamera.org/patch/56/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/projects/1/?format=api", "name": "libcamera", "link_name": "libcamera", "list_id": "libcamera_core", "list_email": "libcamera-devel@lists.libcamera.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20181218204609.22902-1-laurent.pinchart@ideasonboard.com>", "date": "2018-12-18T20:46:08", "name": "[libcamera-devel,1/2] utils: checkstyle.py: Highlight trailing white space at end of line", "commit_ref": "cf04a496a6e70d180446b519a7f90618b36b4479", "pull_url": null, "state": "accepted", "archived": false, "hash": "6c26fe3b8afd287dc6281cd399a88b4ee1dbec6e", "submitter": { "id": 2, "url": "https://patchwork.libcamera.org/api/people/2/?format=api", "name": "Laurent Pinchart", "email": "laurent.pinchart@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/56/mbox/", "series": [ { "id": 29, "url": "https://patchwork.libcamera.org/api/series/29/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=29", "date": "2018-12-18T20:46:09", "name": "[libcamera-devel,1/2] utils: checkstyle.py: Highlight trailing white space at end of line", "version": 1, "mbox": "https://patchwork.libcamera.org/series/29/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/56/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/56/checks/", "tags": {}, "headers": { "Return-Path": "<laurent.pinchart@ideasonboard.com>", "Received": [ "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 55C6260B23\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 18 Dec 2018 21:45:24 +0100 (CET)", "from avalon.bb.dnainternet.fi\n\t(dfj612ybrt5fhg77mgycy-3.rev.dnainternet.fi\n\t[IPv6:2001:14ba:21f5:5b00:2e86:4862:ef6a:2804])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id C87CD53A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 18 Dec 2018 21:45:19 +0100 (CET)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1545165919;\n\tbh=0VoY01dXeq80F1bln/7FulDHCCh+T3RxzJFsWGDR1zg=;\n\th=From:To:Subject:Date:From;\n\tb=VqwcOH3tJ4wHQluZl+Q8nnq+YyyNFsYwjV5UGC4KCT+um6g+XmVPYzUdglon9Q45u\n\tR0BGirRiTEgWJX8DiB3PeXPf9mmfpDLeLTmVpIukYlXoKOSO0DQXfWPe7mXgtSWcUm\n\t6cMrsutoo5tjco1PQVwQanL47H8xsD+iVRd1EtpM=", "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Tue, 18 Dec 2018 22:46:08 +0200", "Message-Id": "<20181218204609.22902-1-laurent.pinchart@ideasonboard.com>", "X-Mailer": "git-send-email 2.19.2", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH 1/2] utils: checkstyle.py: Highlight\n\ttrailing white space at end of line", "X-BeenThere": "libcamera-devel@lists.libcamera.org", "X-Mailman-Version": "2.1.23", "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>", "X-List-Received-Date": "Tue, 18 Dec 2018 20:45:24 -0000" }, "content": "In order to facilitate interpretation of diffs, highlight trailing white\nspace at end of lines with a red background.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n utils/checkstyle.py | 67 ++++++++++++++++++++++++++++++++++-----------\n 1 file changed, 51 insertions(+), 16 deletions(-)", "diff": "diff --git a/utils/checkstyle.py b/utils/checkstyle.py\nindex b7c4d876a145..dadb55dfb8c1 100755\n--- a/utils/checkstyle.py\n+++ b/utils/checkstyle.py\n@@ -40,18 +40,43 @@ source_extensions = (\n \n class Colours:\n Default = 0\n+ Black = 0\n Red = 31\n Green = 32\n+ Yellow = 33\n+ Blue = 34\n+ Magenta = 35\n Cyan = 36\n+ LightGrey = 37\n+ DarkGrey = 90\n+ LightRed = 91\n+ LightGreen = 92\n+ Lightyellow = 93\n+ LightBlue = 94\n+ LightMagenta = 95\n+ LightCyan = 96\n+ White = 97\n+\n+ @staticmethod\n+ def fg(colour):\n+ if sys.stdout.isatty():\n+ return '\\033[%um' % colour\n+ else:\n+ return ''\n \n-for attr in Colours.__dict__.keys():\n- if attr.startswith('_'):\n- continue\n+ @staticmethod\n+ def bg(colour):\n+ if sys.stdout.isatty():\n+ return '\\033[%um' % (colour + 10)\n+ else:\n+ return ''\n \n- if sys.stdout.isatty():\n- setattr(Colours, attr, '\\033[0;%um' % getattr(Colours, attr))\n- else:\n- setattr(Colours, attr, '')\n+ @staticmethod\n+ def reset():\n+ if sys.stdout.isatty():\n+ return '\\033[0m'\n+ else:\n+ return ''\n \n \n class DiffHunkSide(object):\n@@ -82,20 +107,30 @@ class DiffHunk(object):\n \n def __repr__(self):\n s = '%s@@ -%u,%u +%u,%u @@\\n' % \\\n- (Colours.Cyan,\n+ (Colours.fg(Colours.Cyan),\n self.__from.start, len(self.__from),\n self.__to.start, len(self.__to))\n \n for line in self.lines:\n if line[0] == '-':\n- s += Colours.Red\n+ s += Colours.fg(Colours.Red)\n elif line[0] == '+':\n- s += Colours.Green\n- else:\n- s += Colours.Default\n+ s += Colours.fg(Colours.Green)\n+\n+ if line[0] == '-':\n+ spaces = 0\n+ for i in range(len(line)):\n+ if line[-i-1].isspace():\n+ spaces += 1\n+ else:\n+ break\n+ spaces = len(line) - spaces\n+ line = line[0:spaces] + Colours.bg(Colours.Red) + line[spaces:]\n+\n s += line\n+ s += Colours.reset()\n+ s += '\\n'\n \n- s += Colours.Default\n return s\n \n def append(self, line):\n@@ -111,7 +146,7 @@ class DiffHunk(object):\n self.__to.touched.append(self.__to_line)\n self.__to_line += 1\n \n- self.lines.append(line)\n+ self.lines.append(line.rstrip('\\n'))\n \n def intersects(self, lines):\n for line in lines:\n@@ -180,8 +215,8 @@ def check_file(top_level, commit, filename):\n if len(formatted_diff) == 0:\n return 0\n \n- print('%s---' % Colours.Red, filename)\n- print('%s+++' % Colours.Green, filename)\n+ print('%s---' % Colours.fg(Colours.Red), filename)\n+ print('%s+++' % Colours.fg(Colours.Green), filename)\n for hunk in formatted_diff:\n print(hunk)\n \n", "prefixes": [ "libcamera-devel", "1/2" ] }