[Tracker-discuss] [issue587] Link GitHub pull requests in comments

2016-12-01 Thread Ezio Melotti

Ezio Melotti added the comment:

Done in https://hg.python.org/tracker/python-dev/rev/8708baeae844
Thanks for the patch!

--
assignedto: anish.shah -> ezio.melotti
nosy: +ezio.melotti
status: in-progress -> testing

___
PSF Meta Tracker 

___
___
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/


[Tracker-discuss] [issue587] Link GitHub pull requests in comments (depends on issue 586)

2016-07-20 Thread Anish Shah
Anish Shah added the comment:

I have updated the patch. :)

___
PSF Meta Tracker 
<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(\#|\b(?1?\d{1,6}))\b', re.I)
 
+# PR number, pull request number, pullrequest number
+pullrequest_re = 
re.compile(r'(?P(\b(?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 = ('%(text)s')
+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 http://docs.python.org/devguide/committing.html#using-several-working-copies";>devguide/committing.html#using-several-working-copies
 see devguide/committing#using-several-working-copies
 see http://docs.python.org/devguide/committing#using-several-working-copies";>devguide/committing#using-several-working-copies
+check my pullrequest 1000 on github
+check my https://github.com/python/cpython/pull/1000"; 
target="_blank">pullrequest 1000 on github
+check my PR 1000 on github
+check my https://github.com/python/cpython/pull/1000"; 
target="_blank">PR 1000 on github
+check my pull request 1000 on github
+check my https://github.com/python/cpython/pull/1000"; 
target="_blank">pull request 1000 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/

[Tracker-discuss] [issue587] Link GitHub pull requests in comments (depends on issue 586)

2016-07-19 Thread R David Murray

R David Murray added the comment:

Don't do lookups, do mechanical translation.  The translation happens at page 
rendering time, so if github changes it URLs (or we move to a different 
provider), we just change the linkifier code to match.

--
nosy: +r.david.murray

___
PSF Meta Tracker 

___
___
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/