allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shalithasura...@apache.org
Subject [1/2] allura git commit: [#8081] add 'continue' lines, change print to logging
Date Thu, 01 Nov 2018 14:58:42 GMT
Repository: allura
Updated Branches:
  refs/heads/master ffac799c1 -> 01c5c4a11


[#8081] add 'continue' lines, change print to logging


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

Branch: refs/heads/master
Commit: 1a2f3f74a398422fe70d6b482cdd779f728e9a21
Parents: a9fcf8d
Author: Dave Brondsema <dave@brondsema.net>
Authored: Tue Oct 30 16:31:13 2018 -0400
Committer: Dave Brondsema <dave@brondsema.net>
Committed: Tue Oct 30 16:31:13 2018 -0400

----------------------------------------------------------------------
 ...update_subscriptions_ticket_and_mr_titles.py | 22 +++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/1a2f3f74/scripts/migrations/034-update_subscriptions_ticket_and_mr_titles.py
----------------------------------------------------------------------
diff --git a/scripts/migrations/034-update_subscriptions_ticket_and_mr_titles.py b/scripts/migrations/034-update_subscriptions_ticket_and_mr_titles.py
index ff13e8b..4ca1cf8 100644
--- a/scripts/migrations/034-update_subscriptions_ticket_and_mr_titles.py
+++ b/scripts/migrations/034-update_subscriptions_ticket_and_mr_titles.py
@@ -37,13 +37,17 @@ def main():
     # Fix ticket artifcat titles
     title = re.compile('^Ticket [0-9]')
     subs_tickets = M.Mailbox.query.find(dict(artifact_title=title)).all()
-    print 'Found total %d old artifact titles (tickets).' % len(subs_tickets)
+    log.info('Found total %d old artifact titles (tickets).', len(subs_tickets))
     for sub in subs_tickets:
+        if not sub.artifact_index_id:
+            log.info('No artifact_index_id on %s', sub)
+            continue
         ticket = TM.Ticket.query.get(_id = ObjectId(sub.artifact_index_id.split('#')[1]))
         if not ticket:
-            print 'Could not find ticket for %s' % sub
+            log.info('Could not find ticket for %s', sub)
+            continue
         new_title = 'Ticket #%d: %s' % (ticket.ticket_num, ticket.summary)
-        print '"%s" --> "%s"' % (sub.artifact_title , new_title)
+        log.info('"%s" --> "%s"', sub.artifact_title, new_title)
         if(task != 'diff'):
             sub.artifact_title = new_title
         session(sub).flush(sub)
@@ -51,14 +55,18 @@ def main():
     # Fix merge request artifact titles
     title = re.compile('^Merge request: ')
     subs_mrs = M.Mailbox.query.find(dict(artifact_title=title)).all()
-    print 'Found total %d old artifact titles (merge_requests).' % len(subs_tickets)
+    log.info('Found total %d old artifact titles (merge_requests).', len(subs_tickets))
     for sub in subs_mrs:
+        if not sub.artifact_index_id:
+            log.info('No artifact_index_id on %s', sub)
+            continue
         merge_request = M.MergeRequest.query.get(_id = ObjectId(sub.artifact_index_id.split('#')[1]))
         if not merge_request:
-            print 'Could not find merge request for %s' % sub
+            log.info('Could not find merge request for %s', sub)
+            continue
         new_title = 'Merge Request #%d: %s' % (merge_request.request_number, merge_request.summary)
-        print '"%s" --> "%s"' % (sub.artifact_title , new_title)
-        if(task != 'diff'):
+        log.info('"%s" --> "%s"', sub.artifact_title , new_title)
+        if task != 'diff':
             sub.artifact_title = new_title
         session(sub).flush(sub)
 


Mime
View raw message