allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From john...@apache.org
Subject [05/50] git commit: [#6441] ticket:398 fixed link with comments in tickets imported from trac
Date Mon, 12 Aug 2013 16:40:50 GMT
[#6441]  ticket:398 fixed link with comments  in tickets imported from trac


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

Branch: refs/heads/cj/6422
Commit: 7975c7c778e2ca346a3084513ee2fdb24ae253db
Parents: 70ee25a
Author: Yuriy Arhipov <yuriyarhipovua@yandex.ru>
Authored: Tue Jul 23 07:19:47 2013 +0400
Committer: Tim Van Steenburgh <tvansteenburgh@gmail.com>
Committed: Wed Jul 31 12:21:14 2013 +0000

----------------------------------------------------------------------
 ForgeTracker/forgetracker/import_support.py            | 13 ++++++++-----
 .../forgetracker/tests/functional/test_import.py       |  4 ++--
 2 files changed, 10 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/7975c7c7/ForgeTracker/forgetracker/import_support.py
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/import_support.py b/ForgeTracker/forgetracker/import_support.py
index 8735f40..26e182e 100644
--- a/ForgeTracker/forgetracker/import_support.py
+++ b/ForgeTracker/forgetracker/import_support.py
@@ -217,7 +217,8 @@ class ImportSupport(object):
         return '(%s)' % m.groups()[0]
 
     def ticket_bracket_link(self, m):
-        return '[#%s]' % m.groups()[0]
+        text = m.groups()[0]
+        return '[\[%s\]](%s:#%s)' % (text, c.app.config.options.mount_point, text)
 
     def get_slug_by_id(self, ticket, comment):
         comment = int(comment)
@@ -234,19 +235,21 @@ class ImportSupport(object):
             return comments.all()[comment-1].slug
 
     def comment_link(self, m):
-        ticket, comment = m.groups()
+        text, ticket, comment = m.groups()
+        ticket = ticket.replace('\n', '')
+        text = text.replace('\n', ' ')
         slug = self.get_slug_by_id(ticket, comment)
         if slug:
-            return '(%s#%s)' % (ticket, self.get_slug_by_id(ticket, comment))
+            return '[%s](%s#%s)' % (text, ticket, slug)
         else:
-            return '\(%s#comment:%s\)' % (ticket, comment)
+            return text
 
     def brackets_escaping(self, m):
         return '[\[%s\]]' % m.groups()[0]
 
     def link_processing(self, text):
         short_link_ticket_pattern = re.compile('(?<!\[)#(\d+)(?!\])')
-        comment_pattern = re.compile('\(\S*/(\d+)#comment:(\d+)\)')
+        comment_pattern = re.compile('\[(\S*\s*\S*)\]\(\S*/(\d+\n*\d*)#comment:(\d+)\)')
         ticket_pattern = re.compile('(?<=\])\(\S*ticket/(\d+)\)')
         brackets_pattern = re.compile('\[\[(.*)\]\]')
 

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/7975c7c7/ForgeTracker/forgetracker/tests/functional/test_import.py
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/tests/functional/test_import.py b/ForgeTracker/forgetracker/tests/functional/test_import.py
index 1fc7331..f876b93 100644
--- a/ForgeTracker/forgetracker/tests/functional/test_import.py
+++ b/ForgeTracker/forgetracker/tests/functional/test_import.py
@@ -177,10 +177,10 @@ class TestImportController(TestRestApiBase):
                                        #200''')
 
         assert "test link [\[2496\]](http://testlink.com)" in result
-        assert '[test comment]\(204#comment:1\)' in result
+        assert 'test comment' in result
         assert 'test link [\[2496\]](http://testlink.com)' in result
         assert 'test ticket ([#201](201))' in result
-        assert '[#200]' in result
+        assert '[\[200\]](bugs:#200)' in result, result
 
     @td.with_tracker
     def test_links(self):


Mime
View raw message