From: Nathan Cutler Date: Wed, 13 Nov 2019 10:37:15 +0000 (+0100) Subject: backport-resolve-issue: narrow regular expression X-Git-Tag: v15.1.0~853^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=a51ec07c6bdf9b5e0ba9a9c82d65dd2dd4de7546;p=ceph.git backport-resolve-issue: narrow regular expression The regular expression used to extract tracker URLs from the PR body was too generous. When there are two URLs on the same line and the second is a tracker URl, the regex picked up both of them. For example, the following string matched the regex: "https://github.com/ceph/ceph/pull/26538, https://tracker.ceph.com/issues/41452" This commit fixes the issue. Signed-off-by: Nathan Cutler --- diff --git a/src/script/backport-resolve-issue b/src/script/backport-resolve-issue index 2b4626595c13..a089aca3ed5f 100755 --- a/src/script/backport-resolve-issue +++ b/src/script/backport-resolve-issue @@ -393,7 +393,7 @@ Ceph version: base {}, target {}'''.format(self.github_url, pr_title_trunc, # for bt in self.backport_trackers: # does the Backport Tracker description link back to the GitHub PR? - p = re.compile('http.*://github.com/ceph/ceph/pull/\\d+') + p = re.compile('http.?://github.com/ceph/ceph/pull/\\d+') bt.tracker_description = bt.redmine_issue.description bt.github_url_from_tracker = None try: @@ -487,7 +487,7 @@ Ceph version: base {}, target {}'''.format(self.github_url, pr_title_trunc, def extract_backport_trackers_from_github_pr_desc(self): global redmine_endpoint - p = re.compile('http.*://tracker.ceph.com/issues/\\d+') + p = re.compile('http.?://tracker.ceph.com/issues/\\d+') matching_strings = p.findall(self.github_pr_desc) if not matching_strings: print_outer_divider()