You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by br...@apache.org on 2013/11/01 18:10:00 UTC

[2/3] git commit: [#6610] Don't replace shortlink patterns in raw text blocks

[#6610] Don't replace shortlink patterns in raw text blocks

- This was necessary when we were fetching raw ticket text during export.
  Now that we're fetching html, things that should be links are already
  <a> tags. Any remaining shortlink-like patterns in the ticket text
  should *not* be converted to links.

Signed-off-by: Tim Van Steenburgh <tv...@gmail.com>


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

Branch: refs/heads/master
Commit: 68bd5ae7eed5c39d95b27606ef5c0efe14f55dd5
Parents: 6ddc460
Author: Tim Van Steenburgh <tv...@gmail.com>
Authored: Wed Oct 23 12:55:20 2013 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Fri Nov 1 17:09:53 2013 +0000

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


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/68bd5ae7/ForgeTracker/forgetracker/import_support.py
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/import_support.py b/ForgeTracker/forgetracker/import_support.py
index 9bf0d07..053c925 100644
--- a/ForgeTracker/forgetracker/import_support.py
+++ b/ForgeTracker/forgetracker/import_support.py
@@ -270,12 +270,10 @@ class ImportSupport(object):
         return '[\[%s\]]' % m.groups()[0]
 
     def link_processing(self, text):
-        short_link_ticket_pattern = re.compile('(?<!\[)#(\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('\[\[(.*)\]\]')
 
-        text = short_link_ticket_pattern.sub(self.ticket_bracket_link, text)
         text = comment_pattern.sub(self.comment_link, text)
         text = ticket_pattern.sub(self.ticket_link, text)
         text = brackets_pattern.sub(self.brackets_escaping, text)
@@ -286,7 +284,7 @@ class ImportSupport(object):
         author_id = self.get_user_id(comment_dict['submitter'])
         text = h.really_unicode(self.link_processing(comment_dict['comment']))
         if not author_id and comment_dict['submitter']:
-            text = u'Originally posted by: {0}\n\n{1}'.format(
+            text = u'*Originally posted by:* {0}\n\n{1}'.format(
                     h.really_unicode(comment_dict['submitter']), text)
         comment = thread.post(text=text, timestamp=ts)
         comment.author_id = author_id

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/68bd5ae7/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 5d0a852..30fff74 100644
--- a/ForgeTracker/forgetracker/tests/functional/test_import.py
+++ b/ForgeTracker/forgetracker/tests/functional/test_import.py
@@ -210,13 +210,13 @@ class TestImportController(TestRestApiBase):
         result = import_support.link_processing('''test link [[2496]](http://testlink.com)
                                        test ticket ([#201](http://sourceforge.net/apps/trac/sourceforge/ticket/201))
                                        Replying to [someuser](http://sourceforge.net/apps/trac/sourceforge/ticket/204#comment:1)
-                                       #200''')
+                                       #200 unchanged''')
 
         assert "test link [\[2496\]](http://testlink.com)" in result
         assert 'Replying to [someuser](204/#123)' in result
         assert 'test link [\[2496\]](http://testlink.com)' in result
         assert 'test ticket ([#201](201))' in result
-        assert '[\[200\]](bugs:#200)' in result, result
+        assert '#200 unchanged' in result, result
 
     @td.with_tracker
     def test_links(self):