incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From john...@apache.org
Subject [09/44] git commit: [#6622] ticket:435 Fix ticket regex
Date Wed, 13 Nov 2013 22:57:29 GMT
[#6622] ticket:435 Fix ticket regex


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/9e9b826f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/9e9b826f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/9e9b826f

Branch: refs/heads/cj/6815
Commit: 9e9b826f9ba2389f4de23166aeaaca717ae91415
Parents: ba53605
Author: Igor Bondarenko <jetmind2@gmail.com>
Authored: Mon Oct 14 15:10:18 2013 +0300
Committer: Dave Brondsema <dbrondsema@slashdotmedia.com>
Committed: Wed Nov 13 17:16:55 2013 +0000

----------------------------------------------------------------------
 ForgeImporters/forgeimporters/github/tests/test_utils.py | 6 ++++++
 ForgeImporters/forgeimporters/github/utils.py            | 4 ++--
 2 files changed, 8 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/9e9b826f/ForgeImporters/forgeimporters/github/tests/test_utils.py
----------------------------------------------------------------------
diff --git a/ForgeImporters/forgeimporters/github/tests/test_utils.py b/ForgeImporters/forgeimporters/github/tests/test_utils.py
index 44d186a..0b86623 100644
--- a/ForgeImporters/forgeimporters/github/tests/test_utils.py
+++ b/ForgeImporters/forgeimporters/github/tests/test_utils.py
@@ -43,6 +43,12 @@ class TestGitHubMarkdownConverter(object):
         result = self.conv.convert(text)
         assert_equal(result, 'Ticket [#1]')
 
+        # github treats '#' in the begining as a header
+        text = '#1'
+        assert_equal(self.conv.convert(text), '#1')
+        text = '  #1'
+        assert_equal(self.conv.convert(text), '  #1')
+
     def test_convert_username_ticket(self):
         text = 'user#1'
         result = self.conv.convert(text)

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/9e9b826f/ForgeImporters/forgeimporters/github/utils.py
----------------------------------------------------------------------
diff --git a/ForgeImporters/forgeimporters/github/utils.py b/ForgeImporters/forgeimporters/github/utils.py
index 282e312..f74f8eb 100644
--- a/ForgeImporters/forgeimporters/github/utils.py
+++ b/ForgeImporters/forgeimporters/github/utils.py
@@ -8,7 +8,7 @@ class GitHubMarkdownConverter(object):
         self.project = '%s:%s' % (project, mount_point)
 
     def convert(self, text):
-        _re = re.compile('\S+\s+(#\d+)')
+        _re = re.compile('(\S+\s+)(#\d+)')
         text = _re.sub(self._convert_ticket, text)
 
         _re = re.compile('\S*/\S*@([0-9a-f]{40})')
@@ -31,7 +31,7 @@ class GitHubMarkdownConverter(object):
         return '%s[%s]%s' % (match.group(1), match.group(2)[:6], match.group(3))
 
     def _convert_ticket(self, match):
-        return '[%s]' % match.group(1)
+        return '%s[%s]' % match.groups()
 
     def _convert_user_sha(self, match):
         return '[%s]' % (match.group(1)[:6])


Mime
View raw message