Anish Shah added the comment:

I have updated the patch. :)

_______________________________________________________
PSF Meta Tracker <metatrac...@psf.upfronthosting.co.za>
<http://psf.upfronthosting.co.za/roundup/meta/issue587>
_______________________________________________________
diff --git a/extensions/local_replace.py b/extensions/local_replace.py
index 1dd0e89..b05e3d4 100644
--- a/extensions/local_replace.py
+++ b/extensions/local_replace.py
@@ -111,6 +111,10 @@ substitutions = [
 # if the issue number is too big the db will explode -- limit it to 7 digits
 issue_re = 
re.compile(r'(?P<text>(\#|\b(?<![-/_])issue)\s*(?P<id>1?\d{1,6}))\b', re.I)
 
+# PR number, pull request number, pullrequest number
+pullrequest_re = 
re.compile(r'(?P<text>(\b(?<![-/_])(PR|pull\s*request))\s*(?P<pr_no>1?\d{1,6}))\b',
+                            re.I)
+
 
 class PyDevStringHTMLProperty(StringHTMLProperty):
     def _hyper_repl(self, match):
@@ -142,6 +146,7 @@ class PyDevStringHTMLProperty(StringHTMLProperty):
             message = cre.sub(replacement, message)
         # finally add links for issues
         message = issue_re.sub(self._linkify_issue, message)
+        message = pullrequest_re.sub(self._linkify_pull_request, message)
         return message
 
     def _linkify_issue(self, match):
@@ -165,6 +170,15 @@ class PyDevStringHTMLProperty(StringHTMLProperty):
         return template % dict(issue_id=issue_id, title=title,
                                status=status, text=text)
 
+    def _linkify_pull_request(self, match):
+        """Turn a pullrequest (e.g. 'PR 123') to an HTML link"""
+        template = ('<a href="%(link)s" target="_blank">%(text)s</a>')
+        pr_no = match.group('pr_no')
+        text = match.group('text')
+        base_url = 'https://github.com/python/cpython/pull/{}'
+        pr_url = base_url.format(pr_no)
+        return template % dict(link=pr_url, text=text)
+
 
 noise_changes = re.compile('(nosy_count|message_count)\: \d+\.0( -> \d+\.0)?')
 
diff --git a/extensions/test/local_replace_data.txt 
b/extensions/test/local_replace_data.txt
index bdf1eb9..dbedc6c 100644
--- a/extensions/test/local_replace_data.txt
+++ b/extensions/test/local_replace_data.txt
@@ -234,3 +234,9 @@ see devguide/committing.html#using-several-working-copies
 see <a 
href="http://docs.python.org/devguide/committing.html#using-several-working-copies";>devguide/committing.html#using-several-working-copies</a>
 see devguide/committing#using-several-working-copies
 see <a 
href="http://docs.python.org/devguide/committing#using-several-working-copies";>devguide/committing#using-several-working-copies</a>
+check my pullrequest 1000 on github
+check my <a href="https://github.com/python/cpython/pull/1000"; 
target="_blank">pullrequest 1000</a> on github
+check my PR 1000 on github
+check my <a href="https://github.com/python/cpython/pull/1000"; 
target="_blank">PR 1000</a> on github
+check my pull request 1000 on github
+check my <a href="https://github.com/python/cpython/pull/1000"; 
target="_blank">pull request 1000</a> on github
_______________________________________________
Tracker-discuss mailing list
Tracker-discuss@python.org
https://mail.python.org/mailman/listinfo/tracker-discuss
Code of Conduct: https://www.python.org/psf/codeofconduct/

Reply via email to