HADOOP-12199. Optimize find_changed_modules (Kengo Seki via aw)
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/5e42d11f Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/5e42d11f Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/5e42d11f Branch: refs/heads/HADOOP-12111 Commit: 5e42d11fb53ca56001a30aa09c172317a20ba8fd Parents: 2253f1f Author: Allen Wittenauer <[email protected]> Authored: Fri Jul 10 08:29:57 2015 -0700 Committer: Allen Wittenauer <[email protected]> Committed: Fri Jul 10 08:29:57 2015 -0700 ---------------------------------------------------------------------- dev-support/test-patch.sh | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/5e42d11f/dev-support/test-patch.sh ---------------------------------------------------------------------- diff --git a/dev-support/test-patch.sh b/dev-support/test-patch.sh index 8e139d3..4b6b263 100755 --- a/dev-support/test-patch.sh +++ b/dev-support/test-patch.sh @@ -1006,9 +1006,7 @@ function parse_args ## @return directory containing the pom.xml. Nothing returned if not found. function find_pomxml_dir { - local dir - - dir=$(dirname "$1") + local dir=$1 yetus_debug "Find pom.xml dir for: ${dir}" @@ -1033,9 +1031,7 @@ function find_pomxml_dir ## @return directory containing the build.xml. Nothing returned if not found. function find_buildxml_dir { - local dir - - dir=$(dirname "$1") + local dir=$1 yetus_debug "Find build.xml dir for: ${dir}" @@ -1076,18 +1072,21 @@ function find_changed_files ## @return None; sets ${CHANGED_MODULES} and ${CHANGED_UNFILTERED_MODULES} function find_changed_modules { - # Come up with a list of changed files into ${TMP} + local i + local changed_dirs local pomdirs local pomdir local module local pommods + changed_dirs=$(for i in ${CHANGED_FILES}; do dirname "${i}"; done | sort -u) + # Now find all the modules that were changed - for file in ${CHANGED_FILES}; do + for i in ${changed_dirs}; do case ${BUILDTOOL} in maven) #shellcheck disable=SC2086 - pomdir=$(find_pomxml_dir ${file}) + pomdir=$(find_pomxml_dir ${i}) if [[ -z ${pomdir} ]]; then output_to_console 1 output_to_bugsystem 1 @@ -1097,7 +1096,7 @@ function find_changed_modules ;; ant) #shellcheck disable=SC2086 - pomdir=$(find_buildxml_dir ${file}) + pomdir=$(find_buildxml_dir ${i}) if [[ -z ${pomdir} ]]; then output_to_console 1 output_to_bugsystem 1
