incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tvansteenbu...@apache.org
Subject [26/50] git commit: [#6609] Trac ticket import touchups
Date Thu, 26 Sep 2013 18:29:44 GMT
[#6609] Trac ticket import touchups

- Don't let Markdown conversion wrap lines during ticket export
- Fix comment anchor urls so the page doesn't reload

Signed-off-by: Tim Van Steenburgh <tvansteenburgh@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/05719e45
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/05719e45
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/05719e45

Branch: refs/heads/tv/6612
Commit: 05719e450ed1bdc2866672b8cd144f52c5f48894
Parents: 6286ab1
Author: Tim Van Steenburgh <tvansteenburgh@gmail.com>
Authored: Mon Sep 23 17:09:55 2013 +0000
Committer: Dave Brondsema <dbrondsema@slashdotmedia.com>
Committed: Tue Sep 24 17:19:08 2013 +0000

----------------------------------------------------------------------
 Allura/allura/scripts/trac_export.py                      | 5 +++--
 ForgeTracker/forgetracker/import_support.py               | 2 +-
 ForgeTracker/forgetracker/tests/functional/test_import.py | 7 ++++---
 3 files changed, 8 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/05719e45/Allura/allura/scripts/trac_export.py
----------------------------------------------------------------------
diff --git a/Allura/allura/scripts/trac_export.py b/Allura/allura/scripts/trac_export.py
index 43462df..f54e8bc 100644
--- a/Allura/allura/scripts/trac_export.py
+++ b/Allura/allura/scripts/trac_export.py
@@ -148,7 +148,8 @@ class TracExport(object):
 
     def parse_ticket_comments(self, id):
         # Use RSS export to get ticket comments
-        from html2text import html2text
+        import html2text
+        html2text.BODY_WIDTH = 0
         url = self.full_url(self.TICKET_URL % id, 'rss')
         self.log_url(url)
         d = feedparser.parse(urlopen(url))
@@ -157,7 +158,7 @@ class TracExport(object):
             c = {}
             c['submitter'] = getattr(comment, 'author', None)
             c['date'] = comment.updated_parsed
-            c['comment'] = html2text(comment.summary)
+            c['comment'] = html2text.html2text(comment.summary)
             c['class'] = 'COMMENT'
             res.append(c)
         return res

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/05719e45/ForgeTracker/forgetracker/import_support.py
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/import_support.py b/ForgeTracker/forgetracker/import_support.py
index cfc7839..36c686e 100644
--- a/ForgeTracker/forgetracker/import_support.py
+++ b/ForgeTracker/forgetracker/import_support.py
@@ -249,7 +249,7 @@ class ImportSupport(object):
         text = text.replace('\n', ' ')
         slug = self.get_slug_by_id(ticket, comment)
         if slug:
-            return '[%s](%s#%s)' % (text, ticket, slug)
+            return '[%s](%s/#%s)' % (text, ticket, slug)
         else:
             return text
 

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/05719e45/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 c8ae9e4..9a36db6 100644
--- a/ForgeTracker/forgetracker/tests/functional/test_import.py
+++ b/ForgeTracker/forgetracker/tests/functional/test_import.py
@@ -204,13 +204,14 @@ class TestImportController(TestRestApiBase):
     @td.with_tracker
     def test_link_processing(self):
         import_support = ImportSupport()
+        import_support.get_slug_by_id = lambda ticket, comment: '123'
         result = import_support.link_processing('''test link [[2496]](http://testlink.com)
                                        test ticket ([#201](http://sourceforge.net/apps/trac/sourceforge/ticket/201))
-                                       [test comment](http://sourceforge.net/apps/trac/sourceforge/ticket/204#comment:1)
+                                       Replying to [someuser](http://sourceforge.net/apps/trac/sourceforge/ticket/204#comment:1)
                                        #200''')
 
         assert "test link [\[2496\]](http://testlink.com)" in result
-        assert 'test comment' 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
@@ -234,7 +235,7 @@ class TestImportController(TestRestApiBase):
             thread_id=ticket.discussion_thread._id,
             status={'$in': ['ok', 'pending']})).sort('timestamp').all()[0].slug
 
-        assert '[test comment](204#%s)' % slug in r
+        assert '[test comment](204/#%s)' % slug in r
         assert 'test link [\[2496\]](http://testlink.com)' in r
         assert 'test ticket ([#201](201))' in r
 


Mime
View raw message