summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Jung <flo@windfisch.org>2013-09-03 18:58:56 +0200
committerFlorian Jung <flo@windfisch.org>2013-09-03 18:58:56 +0200
commitd254a80f17f9d1f02c2b0d726c65220691db1122 (patch)
tree11839470dc21f9b1334b22b1dc3fc1cb90b7a0ab
parentcbeed2d5cc5898ebbd73e116148c2173851feb59 (diff)
Display progress
-rwxr-xr-xissues.py16
1 files changed, 10 insertions, 6 deletions
diff --git a/issues.py b/issues.py
index 372e5af..1a6ff68 100755
--- a/issues.py
+++ b/issues.py
@@ -103,7 +103,7 @@ def cleanup_message_body(body):
return body
-def handle_tracker_item(item, issue_title_prefix):
+def handle_tracker_item(item, issue_title_prefix, statusprintprefix):
if len(issue_title_prefix) > 0:
issue_title_prefix = issue_title_prefix.strip() + " "
@@ -169,7 +169,7 @@ def handle_tracker_item(item, issue_title_prefix):
cleanup_message_body(followup.find('field',attrs={'name':'body'}).string),
]))
- print 'Creating: %s [%s] (%d comments)%s for SF #%s from %s' % (title, ','.join(labels), len(comments), ' (closed)' if closed else '', item_id, item_date)
+ print statusprintprefix+ 'Creating: %s [%s] (%d comments)%s for SF #%s from %s' % (title, ','.join(labels), len(comments), ' (closed)' if closed else '', item_id, item_date)
response = rest_call('POST', 'issues', {'title': title, 'body': body})
if response.status_code == 500:
print "ISSUE CAUSED SERVER SIDE ERROR AND WAS NOT SAVED!!! Import will continue."
@@ -178,13 +178,13 @@ def handle_tracker_item(item, issue_title_prefix):
if 'number' not in issue:
raise RuntimeError("No 'number' in issue; response %d invalid" % response.status_code)
number = issue['number']
- print 'Attaching labels: %s' % labels
+ print statusprintprefix + 'Attaching labels: %s' % labels
rest_call('POST', 'issues/%s/labels' % (number), labels)
for comment in comments:
- print 'Creating comment: %s' % comment[:50].replace('\n', ' ').replace(chr(13), '')
+ print statusprintprefix + 'Creating comment: %s' % comment[:50].replace('\n', ' ').replace(chr(13), '')
rest_call('POST', 'issues/%s/comments' % (number), {'body': comment})
if closed:
- print 'Closing...'
+ print statusprintprefix + 'Closing...'
rest_call('PATCH', 'issues/%s' % (number), {'state': 'closed'})
@@ -296,6 +296,10 @@ items.sort(key=item_sorting_key)
userVerify("Everything ok, should I really start?")
github_password = getpass('%s\'s GitHub password: ' % github_user)
+
+n_items=len(items)
+count=1
for item, issue_title_prefix in items:
- handle_tracker_item(item, issue_title_prefix)
+ handle_tracker_item(item, issue_title_prefix, "[%3d%% (%d/%d)] " % (100*count/n_items,count,n_items))
+ count=count+1