From 64b58ccda315902b7b88e32a12ffca3b7b99cdf0 Mon Sep 17 00:00:00 2001 From: "Shane F. Carr" Date: Thu, 26 Sep 2019 08:03:23 +0000 Subject: [PATCH] ICU-20835 Updating check.py to work with CLDR See #852 --- tools/commit-checker/check.py | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/tools/commit-checker/check.py b/tools/commit-checker/check.py index 578461d3527..6b827f5d8b7 100644 --- a/tools/commit-checker/check.py +++ b/tools/commit-checker/check.py @@ -35,6 +35,11 @@ flag_parser.add_argument( help = "A git revision range; see https://git-scm.com/docs/gitrevisions. Should be the two-dot range between the previous release and the current tip.", required = True ) +flag_parser.add_argument( + "--repo-root", + help = "Path to the repository to check", + default = os.path.join(os.path.dirname(__file__), "..", "..") +) flag_parser.add_argument( "--jira-hostname", help = "Hostname of the Jira instance", @@ -55,17 +60,22 @@ flag_parser.add_argument( help = "JQL query load tickets; this should match tickets expected to correspond to the commits being checked. Example: 'project=ICU and fixVersion=63.1'; set fixVersion to the upcoming version.", required = True ) +flag_parser.add_argument( + "--github-url", + help = "Base URL of the GitHub repo", + default = "https://github.com/unicode-org/icu" +) def issue_id_to_url(issue_id, jira_hostname, **kwargs): return "https://%s/browse/%s" % (jira_hostname, issue_id) -def pretty_print_commit(commit, **kwargs): +def pretty_print_commit(commit, github_url, **kwargs): print("- %s `%s`" % (commit.commit.hexsha[:7], commit.commit.summary)) print("\t- Authored by %s <%s>" % (commit.commit.author.name, commit.commit.author.email)) print("\t- Committed at %s" % commit.commit.committed_datetime.isoformat()) - print("\t- GitHub Link: %s" % "https://github.com/unicode-org/icu/commit/%s" % commit.commit.hexsha) + print("\t- GitHub Link: %s" % "%s/commit/%s" % (github_url, commit.commit.hexsha)) def pretty_print_issue(issue, **kwargs): @@ -77,14 +87,13 @@ def pretty_print_issue(issue, **kwargs): print("\t- Jira Link: %s" % issue_id_to_url(issue.issue_id, **kwargs)) -def get_commits(rev_range, **kwargs): +def get_commits(repo_root, rev_range, **kwargs): """ Yields an ICUCommit for each commit in the user-specified rev-range. """ - repo_path = os.path.join(os.path.dirname(__file__), "..", "..") - repo = Repo(repo_path) + repo = Repo(repo_root) for commit in repo.iter_commits(rev_range): - match = re.search(r"^(ICU-\d+) ", commit.message) + match = re.search(r"^(\w+-\d+) ", commit.message) if match: yield ICUCommit(match.group(1), commit) else: