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 2014/08/20 19:49:52 UTC

[1/3] git commit: [#7582] explain purpose of script more

Repository: allura
Updated Branches:
  refs/heads/master e0ab435c0 -> d54e5d426


[#7582] explain purpose of script more


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

Branch: refs/heads/master
Commit: d54e5d4260b951010163f1dcd1365beae66d03c7
Parents: d39a168
Author: Dave Brondsema <db...@slashdotmedia.com>
Authored: Wed Aug 20 17:29:12 2014 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Wed Aug 20 17:29:18 2014 +0000

----------------------------------------------------------------------
 scripts/create-moved-tickets.py | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/d54e5d42/scripts/create-moved-tickets.py
----------------------------------------------------------------------
diff --git a/scripts/create-moved-tickets.py b/scripts/create-moved-tickets.py
index 8d9821b..04ce906 100644
--- a/scripts/create-moved-tickets.py
+++ b/scripts/create-moved-tickets.py
@@ -16,13 +16,20 @@
 #       specific language governing permissions and limitations
 #       under the License.
 
+
+'''
+This is for making redirects for tickets that we move from SourceForge
+to Apache, but could be generalized pretty easily to work for making
+any type of redirect (change SF/Apache specifics to commandline arguments)
+'''
+
 import argparse
 import pymongo
 
 
 def get_opts():
     parser = argparse.ArgumentParser(
-        description='Create a MovingTicket records for tickets that will be moved to Apache')
+        description='Create MovedTicket records for SourceForge tickets that will be moved to Apache')
     parser.add_argument('-n', help='Neighborhood', default='p')
     parser.add_argument('-p', help='Project', default='allura')
     parser.add_argument('-t', help='Tool mount point', default='tickets')


[3/3] git commit: [#7562] ticket:618 Set app_config_id to something special for tickets we about to move

Posted by br...@apache.org.
[#7562] ticket:618 Set app_config_id to something special for tickets we about to move


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

Branch: refs/heads/master
Commit: 4a2e88b3ff0de75faeb9eeb1ec2888a36ef1acb3
Parents: e0ab435
Author: Igor Bondarenko <je...@gmail.com>
Authored: Tue Aug 5 14:57:49 2014 +0300
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Wed Aug 20 17:29:18 2014 +0000

----------------------------------------------------------------------
 scripts/create-moved-tickets.py | 59 ++++++++++++++++++++++++++++++++++++
 1 file changed, 59 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/4a2e88b3/scripts/create-moved-tickets.py
----------------------------------------------------------------------
diff --git a/scripts/create-moved-tickets.py b/scripts/create-moved-tickets.py
new file mode 100644
index 0000000..a87d9d0
--- /dev/null
+++ b/scripts/create-moved-tickets.py
@@ -0,0 +1,59 @@
+#!/usr/bin/env python
+#       Licensed to the Apache Software Foundation (ASF) under one
+#       or more contributor license agreements.  See the NOTICE file
+#       distributed with this work for additional information
+#       regarding copyright ownership.  The ASF licenses this file
+#       to you under the Apache License, Version 2.0 (the
+#       "License"); you may not use this file except in compliance
+#       with the License.  You may obtain a copy of the License at
+#
+#         http://www.apache.org/licenses/LICENSE-2.0
+#
+#       Unless required by applicable law or agreed to in writing,
+#       software distributed under the License is distributed on an
+#       "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#       KIND, either express or implied.  See the License for the
+#       specific language governing permissions and limitations
+#       under the License.
+
+import sys
+import argparse
+from pprint import pprint
+
+import pymongo
+
+
+def get_opts():
+    parser = argparse.ArgumentParser(
+        description='Create a MovingTicket records for tickets that will be moved to Apache')
+    parser.add_argument('-n', help='Neighborhood', default='p')
+    parser.add_argument('-p', help='Project', default='allura')
+    parser.add_argument('-t', help='Tool mount point', default='tickets')
+    parser.add_argument('-f', '--file', help='Path to file with ticket numbers')
+    parser.add_argument('--dry-run', help='Run in test mode', action='store_true')
+    parser.add_argument('-m', '--mongo', help='Mongo connection string', default='mongodb://localhost:27017/')
+    parser.add_argument('--db', help='Database name', default='allura')
+    opts = parser.parse_args()
+    return opts
+
+opts = get_opts()
+ticket_nums = open(opts.file, 'r').read().split()
+ticket_nums = [int(num.strip()) for num in ticket_nums]
+
+db = pymongo.MongoClient(opts.mongo)
+main_db = db[opts.db]
+project_data = db['project-data']
+
+nbhd = main_db.neighborhood.find_one({'url_prefix': '/%s/' % opts.n})
+project = main_db.project.find_one({'neighborhood_id': nbhd['_id'], 'shortname': opts.p})
+tool = project_data.config.find_one({'project_id': project['_id'], 'options.mount_point': opts.t})
+
+print "Tool id: %s" % tool['_id']
+print 'Setting app_config_id to: %s for tickets: %s' % ('moved-to-apache', ticket_nums)
+
+if not opts.dry_run:
+    project_data.ticket.update({
+        'app_config_id': tool['_id'],
+        'ticket_num': {'$in': ticket_nums}
+    }, {'$set': {'app_config_id': 'moved-to-apache'}},
+    multi=True)


[2/3] git commit: [#7562] ticket:618 Create MovedTicket records

Posted by br...@apache.org.
 [#7562] ticket:618 Create MovedTicket records


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

Branch: refs/heads/master
Commit: d39a168f64745775941aad8525166dc9a68d79a6
Parents: 4a2e88b
Author: Igor Bondarenko <je...@gmail.com>
Authored: Tue Aug 5 16:34:18 2014 +0300
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Wed Aug 20 17:29:18 2014 +0000

----------------------------------------------------------------------
 scripts/create-moved-tickets.py | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/d39a168f/scripts/create-moved-tickets.py
----------------------------------------------------------------------
diff --git a/scripts/create-moved-tickets.py b/scripts/create-moved-tickets.py
index a87d9d0..8d9821b 100644
--- a/scripts/create-moved-tickets.py
+++ b/scripts/create-moved-tickets.py
@@ -16,10 +16,7 @@
 #       specific language governing permissions and limitations
 #       under the License.
 
-import sys
 import argparse
-from pprint import pprint
-
 import pymongo
 
 
@@ -55,5 +52,14 @@ if not opts.dry_run:
     project_data.ticket.update({
         'app_config_id': tool['_id'],
         'ticket_num': {'$in': ticket_nums}
-    }, {'$set': {'app_config_id': 'moved-to-apache'}},
-    multi=True)
+    }, {'$set': {'app_config_id': 'moved-to-apache'}}, multi=True)
+
+print 'Creating MovingTickets for tickets: %s' % ticket_nums
+
+if not opts.dry_run:
+    for num in ticket_nums:
+        project_data.moved_ticket.insert({
+            'app_config_id': tool['_id'],
+            'ticket_num': num,
+            'moved_to_url': 'https://forge-allura.apache.org/p/allura/tickets/%s' % num,
+        })