From patchwork Sun Jul 24 14:17:37 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 72661 Delivered-To: patch@linaro.org Received: by 10.140.29.52 with SMTP id a49csp720582qga; Sun, 24 Jul 2016 07:18:39 -0700 (PDT) X-Received: by 10.194.148.202 with SMTP id tu10mr11033909wjb.56.1469369919524; Sun, 24 Jul 2016 07:18:39 -0700 (PDT) Return-Path: Received: from theia.denx.de (theia.denx.de. [85.214.87.163]) by mx.google.com with ESMTP id 204si17237746wmk.76.2016.07.24.07.18.39; Sun, 24 Jul 2016 07:18:39 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 85.214.87.163 as permitted sender) client-ip=85.214.87.163; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@nifty.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 85.214.87.163 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id F13DDA7673; Sun, 24 Jul 2016 16:18:33 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id nn9PvQjj6Irs; Sun, 24 Jul 2016 16:18:33 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 3FFB4A76BB; Sun, 24 Jul 2016 16:18:29 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id C872AA75DC for ; Sun, 24 Jul 2016 16:18:21 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 5itndt4v7SWv for ; Sun, 24 Jul 2016 16:18:21 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from conuserg-08.nifty.com (conuserg-08.nifty.com [210.131.2.75]) by theia.denx.de (Postfix) with ESMTPS id 1C14FA7581 for ; Sun, 24 Jul 2016 16:18:17 +0200 (CEST) Received: from grover.sesame (FL1-119-242-215-193.osk.mesh.ad.jp [119.242.215.193]) (authenticated) by conuserg-08.nifty.com with ESMTP id u6OEHflP008919; Sun, 24 Jul 2016 23:17:47 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com u6OEHflP008919 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1469369867; bh=BN/m7mZFKvO2WSP2akR8FNjE8ar/2M0JYmJUu47nVGU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Cmu24AbhGIiuuBFDYoaguCs+LjIj4M532Mr3a5u4BQZSr7rHJKwtGiZEUb/0vj8XW 1Zq1SPUNY2l9SiYlyGURxNBTMt9MhLtOsFw++SPTHlg91/+P0bPwAyFplAKngEFg0C GaMhn/pi4xhbOpPYEc/+t97Pg7ATHuXlM4c07nltF8aGBDKxZAjTce4NqJdlA4SDOB qyg5CZJhdsBPpF5Bfj9eGnorYnvoaDcLzFO1Fy7Q7sINci16KbORKnzCbNes1Aka0f txWj0vjWXiYDpKlOjiRGbXrHhbOwE/fYKFl4YvhiZvFjozU6R2wh629sqn5DW2Zc3p yDJ/N6pNmaTyw== X-Nifty-SrcIP: [119.242.215.193] From: Masahiro Yamada To: u-boot@lists.denx.de Date: Sun, 24 Jul 2016 23:17:37 +0900 Message-Id: <1469369859-14277-3-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1469369859-14277-1-git-send-email-yamada.masahiro@socionext.com> References: <1469369859-14277-1-git-send-email-yamada.masahiro@socionext.com> Cc: Tom Rini , Joe Hershberger Subject: [U-Boot] [PATCH 2/4] tools: moveconfig: show result of header cleaning in unified diff X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" The header cleanup feature of this tool now removes empty ifdef's, successive blank lines as well as moved option defines. So, we want to see a little more context to check which lines were deleted. It is true that we can see it by "git diff", but it would not work in the --dry-run mode. So, here, this commit. Signed-off-by: Masahiro Yamada --- tools/moveconfig.py | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) -- 1.9.1 _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot diff --git a/tools/moveconfig.py b/tools/moveconfig.py index 7d018e4..27bd958 100755 --- a/tools/moveconfig.py +++ b/tools/moveconfig.py @@ -161,6 +161,7 @@ To see the complete list of supported options, run """ import copy +import difflib import filecmp import fnmatch import multiprocessing @@ -395,16 +396,24 @@ def cleanup_one_header(header_path, patterns, dry_run): if matched == old_matched: break - for i in matched: - print '%s: %s: %s' % (header_path, i + 1, lines[i]), + tolines = copy.copy(lines) + + for i in reversed(matched): + tolines.pop(i) + + diff = difflib.unified_diff(lines, tolines, + fromfile=os.path.join('a', header_path), + tofile=os.path.join('b', header_path)) + + for line in diff: + print line, if dry_run: return with open(header_path, 'w') as f: - for i, line in enumerate(lines): - if not i in matched: - f.write(line) + for line in tolines: + f.write(line) def cleanup_headers(configs, dry_run): """Delete config defines from board headers.