Return-Path: X-Original-To: apmail-yetus-commits-archive@minotaur.apache.org Delivered-To: apmail-yetus-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id B016718731 for ; Thu, 7 Jan 2016 11:22:23 +0000 (UTC) Received: (qmail 12612 invoked by uid 500); 7 Jan 2016 11:22:23 -0000 Delivered-To: apmail-yetus-commits-archive@yetus.apache.org Received: (qmail 12592 invoked by uid 500); 7 Jan 2016 11:22:23 -0000 Mailing-List: contact commits-help@yetus.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@yetus.apache.org Delivered-To: mailing list commits@yetus.apache.org Received: (qmail 12583 invoked by uid 99); 7 Jan 2016 11:22:23 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 07 Jan 2016 11:22:23 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 5F0E4E0AF0; Thu, 7 Jan 2016 11:22:23 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: sekikn@apache.org To: commits@yetus.apache.org Message-Id: <41e880268ae847aaa23a707a27aff67c@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: yetus git commit: YETUS-265. maven javadocs aren't calcdiff'd correctly Date: Thu, 7 Jan 2016 11:22:23 +0000 (UTC) Repository: yetus Updated Branches: refs/heads/master 0d22ad1cc -> cccbb02ac YETUS-265. maven javadocs aren't calcdiff'd correctly Signed-off-by: Kengo Seki Project: http://git-wip-us.apache.org/repos/asf/yetus/repo Commit: http://git-wip-us.apache.org/repos/asf/yetus/commit/cccbb02a Tree: http://git-wip-us.apache.org/repos/asf/yetus/tree/cccbb02a Diff: http://git-wip-us.apache.org/repos/asf/yetus/diff/cccbb02a Branch: refs/heads/master Commit: cccbb02accef0b35bd09d35f93363127d5183bc3 Parents: 0d22ad1 Author: Allen Wittenauer Authored: Tue Dec 29 12:36:35 2015 -0800 Committer: Kengo Seki Committed: Thu Jan 7 20:21:53 2016 +0900 ---------------------------------------------------------------------- precommit/test-patch.d/maven.sh | 47 ++++++++++++++++++++++++------------ 1 file changed, 31 insertions(+), 16 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/yetus/blob/cccbb02a/precommit/test-patch.d/maven.sh ---------------------------------------------------------------------- diff --git a/precommit/test-patch.d/maven.sh b/precommit/test-patch.d/maven.sh index 435c7a1..7068ea6 100755 --- a/precommit/test-patch.d/maven.sh +++ b/precommit/test-patch.d/maven.sh @@ -243,15 +243,14 @@ function maven_javadoc_logfilter ${GREP} -E '\[(ERROR|WARNING)\] /.*\.java:' "${input}" > "${output}" } -## @description Calculate the differences between the specified files -## @description and output it to stdout, the maven way +## @description handle diffing maven javac errors ## @audience private ## @stability evolving ## @replaceable no ## @param branchlog ## @param patchlog ## @return differences -function maven_java_calcdiffs +function maven_javac_calcdiffs { declare orig=$1 declare new=$2 @@ -286,18 +285,6 @@ function maven_java_calcdiffs rm "${tmp}.branch" "${tmp}.patch" "${tmp}.lined" 2>/dev/null } -## @description handle diffing maven javac errors -## @audience private -## @stability evolving -## @replaceable no -## @param branchlog -## @param patchlog -## @return differences -function maven_javac_calcdiffs -{ - maven_java_calcdiffs "$@" -} - ## @description handle diffing maven javadoc errors ## @audience private ## @stability evolving @@ -307,7 +294,35 @@ function maven_javac_calcdiffs ## @return differences function maven_javadoc_calcdiffs { - maven_java_calcdiffs "$@" + declare orig=$1 + declare new=$2 + declare tmp=${PATCH_DIR}/pl.$$.${RANDOM} + declare j + + # can't use the generic handler for this because of the + # [WARNING], etc headers. + # strip :linenum from the output, keeping the filename + # shellcheck disable=SC2016 + ${SED} -e 's#:[0-9]*:#:#' "${orig}" > "${tmp}.branch" + # shellcheck disable=SC2016 + ${SED} -e 's#:[0-9]*:#:#' "${new}" > "${tmp}.patch" + + # compare the errors, generating a string of line + # numbers. Sorry portability: GNU diff makes this too easy + ${DIFF} --unchanged-line-format="" \ + --old-line-format="" \ + --new-line-format="%dn " \ + "${tmp}.branch" \ + "${tmp}.patch" > "${tmp}.lined" + + # now, pull out those lines of the raw output + # shellcheck disable=SC2013 + for j in $(cat "${tmp}.lined"); do + # shellcheck disable=SC2086 + head -${j} "${new}" | tail -1 + done + + rm "${tmp}.branch" "${tmp}.patch" "${tmp}.lined" 2>/dev/null } function maven_builtin_personality_modules