You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sqoop.apache.org by ab...@apache.org on 2015/08/13 22:50:59 UTC

sqoop git commit: SQOOP-2477: Sqoop2: Add protection for HTTP error 404 to precommit hook

Repository: sqoop
Updated Branches:
  refs/heads/sqoop2 e0f4d7fe9 -> 194a4dbaf


SQOOP-2477: Sqoop2: Add protection for HTTP error 404 to precommit hook

(Jarek Jarcec Cecho via Abraham Elmahrek)


Project: http://git-wip-us.apache.org/repos/asf/sqoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/sqoop/commit/194a4dba
Tree: http://git-wip-us.apache.org/repos/asf/sqoop/tree/194a4dba
Diff: http://git-wip-us.apache.org/repos/asf/sqoop/diff/194a4dba

Branch: refs/heads/sqoop2
Commit: 194a4dbaf3f5d915d78d8dd85804406659c6982b
Parents: e0f4d7f
Author: Abraham Elmahrek <ab...@apache.org>
Authored: Thu Aug 13 13:50:35 2015 -0700
Committer: Abraham Elmahrek <ab...@apache.org>
Committed: Thu Aug 13 13:50:35 2015 -0700

----------------------------------------------------------------------
 dev-support/test-patch.py | 26 ++++++++++++++++++++++++--
 1 file changed, 24 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/sqoop/blob/194a4dba/dev-support/test-patch.py
----------------------------------------------------------------------
diff --git a/dev-support/test-patch.py b/dev-support/test-patch.py
index fbc6096..7bc55ea 100755
--- a/dev-support/test-patch.py
+++ b/dev-support/test-patch.py
@@ -61,6 +61,11 @@ def sqoop_guess_branch(versions):
 
   return branch
 
+# Open remote URL
+def open_url(url):
+  print "Opening URL: %s" % (url)
+  return urllib2.urlopen(url)
+
 # Verify supported branch
 def sqoop_verify_branch(branch):
   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$")):
     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))
-    (compareLine, compareBranch) = cobertura_get_percentage(urllib2.urlopen("%s%s" % (compare_url, path)))
+    (compareLine, compareBranch) = cobertura_get_percentage(remoteIo)
 
     diffLine = localLine - compareLine
     diffBranch = localBranch - compareBranch
@@ -386,8 +399,17 @@ def findbugs_compare(result, output_dir, compare_url):
   # For each report that exists locally
   for path in list(find_all_files(".", "^findbugs\.xml$")):
     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))
-    remote = findbugs_get_bugs(urllib2.urlopen("%s%s" % (compare_url, path)))
+    remote = findbugs_get_bugs(remoteIo)
     report.write("Processing package %s:\n" % (package))
 
     # Identify the differences for each class