mirror of
https://github.com/apache/sqoop.git
synced 2025-05-19 02:10:54 +08:00
SQOOP-2477: Sqoop2: Add protection for HTTP error 404 to precommit hook
(Jarek Jarcec Cecho via Abraham Elmahrek)
This commit is contained in:
parent
e0f4d7fe96
commit
194a4dbaf3
@ -61,6 +61,11 @@ def sqoop_guess_branch(versions):
|
|||||||
|
|
||||||
return branch
|
return branch
|
||||||
|
|
||||||
|
# Open remote URL
|
||||||
|
def open_url(url):
|
||||||
|
print "Opening URL: %s" % (url)
|
||||||
|
return urllib2.urlopen(url)
|
||||||
|
|
||||||
# Verify supported branch
|
# Verify supported branch
|
||||||
def sqoop_verify_branch(branch):
|
def sqoop_verify_branch(branch):
|
||||||
return branch in ("sqoop2", "SQOOP-1082", "SQOOP-1367",)
|
return branch in ("sqoop2", "SQOOP-1082", "SQOOP-1367",)
|
||||||
@ -343,8 +348,16 @@ def cobertura_compare(result, output_dir, compare_url):
|
|||||||
for path in list(find_all_files(".", "^frame-summary\.html$")):
|
for path in list(find_all_files(".", "^frame-summary\.html$")):
|
||||||
package = path.replace("/target/site/cobertura/frame-summary.html", "").replace("./", "")
|
package = path.replace("/target/site/cobertura/frame-summary.html", "").replace("./", "")
|
||||||
|
|
||||||
|
remoteIo = None
|
||||||
|
try:
|
||||||
|
remoteIo = open_url("%s%s" % (compare_url, path))
|
||||||
|
except urllib2.HTTPError:
|
||||||
|
report.write("Package %s: Base is missing" % (package))
|
||||||
|
summary.append("Package {{%p}}: Can't compare test coverage as base is missing." % (package))
|
||||||
|
continue
|
||||||
|
|
||||||
(localLine, localBranch) = cobertura_get_percentage(open(path))
|
(localLine, localBranch) = cobertura_get_percentage(open(path))
|
||||||
(compareLine, compareBranch) = cobertura_get_percentage(urllib2.urlopen("%s%s" % (compare_url, path)))
|
(compareLine, compareBranch) = cobertura_get_percentage(remoteIo)
|
||||||
|
|
||||||
diffLine = localLine - compareLine
|
diffLine = localLine - compareLine
|
||||||
diffBranch = localBranch - compareBranch
|
diffBranch = localBranch - compareBranch
|
||||||
@ -386,8 +399,17 @@ def findbugs_compare(result, output_dir, compare_url):
|
|||||||
# For each report that exists locally
|
# For each report that exists locally
|
||||||
for path in list(find_all_files(".", "^findbugs\.xml$")):
|
for path in list(find_all_files(".", "^findbugs\.xml$")):
|
||||||
package = path.replace("/target/findbugs.xml", "").replace("./", "")
|
package = path.replace("/target/findbugs.xml", "").replace("./", "")
|
||||||
|
|
||||||
|
remoteIo = None
|
||||||
|
try:
|
||||||
|
remoteIo = open_url("%s%s" % (compare_url, path))
|
||||||
|
except urllib2.HTTPError:
|
||||||
|
report.write("Package %s: Base is missing" % (package))
|
||||||
|
summary.append("Package {{%p}}: Can't compare classes as base is missing." % (package))
|
||||||
|
continue
|
||||||
|
|
||||||
local = findbugs_get_bugs(open(path))
|
local = findbugs_get_bugs(open(path))
|
||||||
remote = findbugs_get_bugs(urllib2.urlopen("%s%s" % (compare_url, path)))
|
remote = findbugs_get_bugs(remoteIo)
|
||||||
report.write("Processing package %s:\n" % (package))
|
report.write("Processing package %s:\n" % (package))
|
||||||
|
|
||||||
# Identify the differences for each class
|
# Identify the differences for each class
|
||||||
|
Loading…
Reference in New Issue
Block a user