"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "tools/load_tracker.py" between
roundup-1.6.1.tar.gz and roundup-2.0.0.tar.gz

About: Roundup is an highly customisable issue-tracking system with command-line, web and e-mail interfaces (written in Python).

load_tracker.py  (roundup-1.6.1):load_tracker.py  (roundup-2.0.0)
#! /usr/bin/env python #! /usr/bin/env python
''' '''
Usage: %s <tracker home> <N> Usage: %s <tracker home> <N>
Load up the indicated tracker with N issues and N/100 users. Load up the indicated tracker with N issues and N/100 users.
''' '''
from __future__ import print_function
import sys, os, random import sys, os, random
from roundup import instance from roundup import instance
# open the instance # open the instance
if len(sys.argv) < 2: if len(sys.argv) < 2:
print "Error: Not enough arguments" print("Error: Not enough arguments")
print __doc__.strip()%(sys.argv[0]) print(__doc__.strip()%(sys.argv[0]))
sys.exit(1) sys.exit(1)
tracker_home = sys.argv[1] tracker_home = sys.argv[1]
N = int(sys.argv[2]) N = int(sys.argv[2])
# open the tracker # open the tracker
tracker = instance.open(tracker_home) tracker = instance.open(tracker_home)
db = tracker.open('admin') db = tracker.open('admin')
db.tx_Source = "cli" db.tx_Source = "cli"
priorities = db.priority.list() priorities = db.priority.list()
skipping to change at line 59 skipping to change at line 60
Donec tincidunt. Donec tincidunt.
Vestibulum gravida. Vestibulum gravida.
Fusce luctus, neque id mattis fringilla, purus pede sodales pede. Fusce luctus, neque id mattis fringilla, purus pede sodales pede.
Quis ultricies urna odio sed orci.'''.splitlines() Quis ultricies urna odio sed orci.'''.splitlines()
try: try:
try: try:
db.user.lookup('alpha0') db.user.lookup('alpha0')
except: except:
# add some users # add some users
M = N/100 M = N//100
for i in range(M): for i in range(M):
print '\ruser', i, ' ', print('\ruser', i, ' ', end=' ')
sys.stdout.flush() sys.stdout.flush()
if i/17 == 0: if i//17 == 0:
db.user.create(username=names[i%17]) db.user.create(username=names[i%17])
else: else:
db.user.create(username=names[i%17]+str(i/17)) db.user.create(username=names[i%17]+str(i//17))
# assignable user list # assignable user list
users = db.user.list() users = db.user.list()
users.remove(db.user.lookup('anonymous')) users.remove(db.user.lookup('anonymous'))
print print()
# now create the issues # now create the issues
for i in range(N): for i in range(N):
print '\rissue', i, ' ', print('\rissue', i, ' ', end=' ')
sys.stdout.flush() sys.stdout.flush()
# in practise, about 90% of issues are resolved # in practise, about 90% of issues are resolved
if random.random() > .9: if random.random() > .9:
status = random.choice(statuses) status = random.choice(statuses)
else: else:
status = resolved_id status = resolved_id
db.issue.create( db.issue.create(
title=random.choice(titles), title=random.choice(titles),
priority=random.choice(priorities), priority=random.choice(priorities),
status=status, status=status,
assignedto=random.choice(users)) assignedto=random.choice(users))
if not i%1000: if not i%1000:
db.commit() db.commit()
print print()
db.commit() db.commit()
finally: finally:
db.close() db.close()
# vim: set filetype=python ts=4 sw=4 et si # vim: set filetype=python ts=4 sw=4 et si
 End of changes. 9 change blocks. 
9 lines changed or deleted 10 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)