yetus-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sek...@apache.org
Subject yetus git commit: YETUS-265. maven javadocs aren't calcdiff'd correctly
Date Thu, 07 Jan 2016 11:22:23 GMT
Repository: yetus
Updated Branches:
  refs/heads/master 0d22ad1cc -> cccbb02ac


YETUS-265. maven javadocs aren't calcdiff'd correctly

Signed-off-by: Kengo Seki <sekikn@apache.org>


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 <aw@apache.org>
Authored: Tue Dec 29 12:36:35 2015 -0800
Committer: Kengo Seki <sekikn@apache.org>
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


Mime
View raw message