HBASE-19098 compatibility checker should handle remotes named something other than 'origin'.
Signed-off-by: Andrew Purtell <apurtell@apache.org>
This commit is contained in:
parent
459202bab0
commit
60aa1c228a
|
@ -120,9 +120,9 @@ def get_git_hash(revname):
|
|||
cwd=get_repo_dir()).strip()
|
||||
|
||||
|
||||
def get_repo_name():
|
||||
def get_repo_name(remote_name="origin"):
|
||||
""" Get the name of the repo based on the git remote."""
|
||||
remote = check_output(["git", "config", "--get", "remote.origin.url"],
|
||||
remote = check_output(["git", "config", "--get", "remote.{0}.url".format(remote_name)],
|
||||
cwd=get_repo_dir()).strip()
|
||||
remote = remote.split("/")[-1]
|
||||
return remote[:-4] if remote.endswith(".git") else remote
|
||||
|
@ -262,7 +262,7 @@ def process_java_acc_output(output):
|
|||
return return_value
|
||||
|
||||
|
||||
def run_java_acc(src_name, src_jars, dst_name, dst_jars, annotations, skip_annotations):
|
||||
def run_java_acc(src_name, src_jars, dst_name, dst_jars, annotations, skip_annotations, name):
|
||||
""" Run the compliance checker to compare 'src' and 'dst'. """
|
||||
logging.info("Will check compatibility between original jars:\n\t%s\n"
|
||||
"and new jars:\n\t%s",
|
||||
|
@ -280,7 +280,7 @@ def run_java_acc(src_name, src_jars, dst_name, dst_jars, annotations, skip_annot
|
|||
out_path = os.path.join(get_scratch_dir(), "report.html")
|
||||
|
||||
args = ["perl", java_acc_path,
|
||||
"-l", get_repo_name(),
|
||||
"-l", name,
|
||||
"-d1", src_xml_path,
|
||||
"-d2", dst_xml_path,
|
||||
"-report-path", out_path]
|
||||
|
@ -424,6 +424,9 @@ def main():
|
|||
parser.add_argument("--verbose",
|
||||
action="store_true",
|
||||
help="more output")
|
||||
parser.add_argument("-r", "--remote", default="origin", dest="remote_name",
|
||||
help="Name of remote to use. e.g. its repo name will be used as the name "
|
||||
"we pass to Java ACC for the library.")
|
||||
parser.add_argument("src_rev", nargs=1, help="Source revision.")
|
||||
parser.add_argument("dst_rev", nargs="?", default="HEAD",
|
||||
help="Destination revision. "
|
||||
|
@ -505,7 +508,8 @@ def main():
|
|||
sys.exit(1)
|
||||
|
||||
output = run_java_acc(src_rev, src_jars, dst_rev,
|
||||
dst_jars, args.annotations, skip_annotations)
|
||||
dst_jars, args.annotations, skip_annotations,
|
||||
get_repo_name(args.remote_name))
|
||||
sys.exit(compare_results(output, known_problems,
|
||||
args.compare_warnings))
|
||||
|
||||
|
|
Loading…
Reference in New Issue