From: Nathan Cutler Date: Mon, 10 Feb 2020 10:46:50 +0000 (+0100) Subject: backport-resolve-issue: extract PR number more carefully X-Git-Tag: v15.1.1~439^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=9ea48e8f7efbd0958669ea119bb3dcaf2b2e04c7;p=ceph.git backport-resolve-issue: extract PR number more carefully This addresses cases where the previous regex '\\d++' was promiscuously matching strings of digits that were not GitHub PR IDs. Signed-off-by: Nathan Cutler --- diff --git a/src/script/backport-resolve-issue b/src/script/backport-resolve-issue index eebbfbad15f8..12478da5070f 100755 --- a/src/script/backport-resolve-issue +++ b/src/script/backport-resolve-issue @@ -510,12 +510,13 @@ Ceph version: base {}, target {}'''.format(self.github_url, pr_title_trunc, def populate_github_url(self): global github_endpoint # GitHub PR ID from merge commit string - p = re.compile('\\d+') + p = re.compile('(pull request|PR) #(\\d+)') try: - self.github_pr_id = p.search(self.merge_commit_description).group() + self.github_pr_id = p.search(self.merge_commit_description).group(2) except AttributeError: assert False, \ "Failed to extract GitHub PR ID from merge commit string ->{}<-".format(self.merge_commit_string) + logging.debug("Merge commit string: {}".format(self.merge_commit_string)) logging.debug("GitHub PR ID from merge commit string: {}".format(self.github_pr_id)) self.github_url = "{}/pull/{}".format(github_endpoint, self.github_pr_id)