##// END OF EJS Templates
issues: make issue_prefix optional again...
Thomas De Schampheleire -
r7083:62b7f3d2 default
parent child Browse files
Show More
@@ -1137,7 +1137,7 b' def urlify_issues(newtext, repo_name):'
1137 issue_pat = CONFIG.get(k)
1137 issue_pat = CONFIG.get(k)
1138 issue_server_link = CONFIG.get('issue_server_link%s' % suffix)
1138 issue_server_link = CONFIG.get('issue_server_link%s' % suffix)
1139 issue_prefix = CONFIG.get('issue_prefix%s' % suffix)
1139 issue_prefix = CONFIG.get('issue_prefix%s' % suffix)
1140 if issue_pat and issue_server_link and issue_prefix:
1140 if issue_pat and issue_server_link and issue_prefix is not None: # issue_prefix can be empty but should be present
1141 log.debug('issue pattern %r: %r -> %r %r', suffix, issue_pat, issue_server_link, issue_prefix)
1141 log.debug('issue pattern %r: %r -> %r %r', suffix, issue_pat, issue_server_link, issue_prefix)
1142 else:
1142 else:
1143 log.error('skipping incomplete issue pattern %r: %r -> %r %r', suffix, issue_pat, issue_server_link, issue_prefix)
1143 log.error('skipping incomplete issue pattern %r: %r -> %r %r', suffix, issue_pat, issue_server_link, issue_prefix)
@@ -415,7 +415,7 b' class TestLibs(TestController):'
415 (r'BUG(\d{5})', 'https://bar/{repo}/', 'BUG',
415 (r'BUG(\d{5})', 'https://bar/{repo}/', 'BUG',
416 'silly me, the URL does not contain {id}, BUG12345.', 'silly me, the URL does not contain {id}, <a class="issue-tracker-link" href="https://bar/repo_name/">BUG12345</a>.'),
416 'silly me, the URL does not contain {id}, BUG12345.', 'silly me, the URL does not contain {id}, <a class="issue-tracker-link" href="https://bar/repo_name/">BUG12345</a>.'),
417 (r'(PR-\d+)', 'http://foo/{repo}/issue/{id}', '',
417 (r'(PR-\d+)', 'http://foo/{repo}/issue/{id}', '',
418 'interesting issue #123, err PR-56', 'interesting issue #123, err PR-56'), # no match because empty prefix
418 'interesting issue #123, err PR-56', 'interesting issue #123, err <a class="issue-tracker-link" href="http://foo/repo_name/issue/PR-56">PR-56</a>'),
419 ])
419 ])
420 def test_urlify_issues(self, issue_pat, issue_server, issue_prefix, sample, expected):
420 def test_urlify_issues(self, issue_pat, issue_server, issue_prefix, sample, expected):
421 from kallithea.lib.helpers import urlify_issues
421 from kallithea.lib.helpers import urlify_issues
@@ -436,7 +436,7 b' class TestLibs(TestController):'
436 ('pull request7 #', '<a class="issue-tracker-link" href="http://pr/repo_name/pr/7">PR#7</a> #'),
436 ('pull request7 #', '<a class="issue-tracker-link" href="http://pr/repo_name/pr/7">PR#7</a> #'),
437 ('look PR9 and pr #11', 'look <a class="issue-tracker-link" href="http://pr/repo_name/pr/9">PR#9</a> and <a class="issue-tracker-link" href="http://pr/repo_name/pr/11">PR#11</a>'),
437 ('look PR9 and pr #11', 'look <a class="issue-tracker-link" href="http://pr/repo_name/pr/9">PR#9</a> and <a class="issue-tracker-link" href="http://pr/repo_name/pr/11">PR#11</a>'),
438 ('pullrequest#10 solves issue 9', '<a class="issue-tracker-link" href="http://pr/repo_name/pr/10">PR#10</a> solves <a class="issue-tracker-link" href="http://bug/repo_name/bug/9">bug#9</a>'),
438 ('pullrequest#10 solves issue 9', '<a class="issue-tracker-link" href="http://pr/repo_name/pr/10">PR#10</a> solves <a class="issue-tracker-link" href="http://bug/repo_name/bug/9">bug#9</a>'),
439 ('issue FAIL67', 'issue FAIL67'), # no match because empty prefix
439 ('issue FAIL67', 'issue <a class="issue-tracker-link" href="http://fail/repo_name/67">67</a>'),
440 ('issue FAILMORE89', 'issue FAILMORE89'), # no match because absent prefix
440 ('issue FAILMORE89', 'issue FAILMORE89'), # no match because absent prefix
441 ])
441 ])
442 def test_urlify_issues_multiple_issue_patterns(self, sample, expected):
442 def test_urlify_issues_multiple_issue_patterns(self, sample, expected):
General Comments 0
You need to be logged in to leave comments. Login now