aboutsummaryrefslogtreecommitdiff
path: root/rt_update_tasks.py
diff options
context:
space:
mode:
authorcpettet <rush@wikimedia.org>2014-12-14 19:30:33 -0600
committercpettet <rush@wikimedia.org>2014-12-14 19:31:23 -0600
commitd33e8c56e65856a410fea855b6b5e9b34b5f3f6a (patch)
tree30080e1059c4a2f60f4927ec3452d634713671aa /rt_update_tasks.py
parent08ca3e6d00133740c9adb62233f97bb802c6889f (diff)
add update job that appends a literal reference
to refer/referd to tasks for RT __This is not idempotent__
Diffstat (limited to 'rt_update_tasks.py')
-rwxr-xr-xrt_update_tasks.py29
1 files changed, 17 insertions, 12 deletions
diff --git a/rt_update_tasks.py b/rt_update_tasks.py
index 47921d4..d8adc5c 100755
--- a/rt_update_tasks.py
+++ b/rt_update_tasks.py
@@ -40,24 +40,29 @@ def update(bugid):
blocker_ref = extref(bugid)
tinfo = json.loads(header[0][0])
+
+ upstream = []
- if 'blocks' not in tinfo['links']:
- log("%s doesn't block anything" % (str(bugid),))
- return True
+ if 'parent' in tinfo['links']:
+ upstream += tinfo['links']['parent']
+
+ if 'blocks' in tinfo['links']:
+ upstream += tinfo['links']['blocks']
- for b in tinfo['links']['blocks']:
- blocked_ref = extref(b)
- log("%s is blocking %s" % (blocker_ref,
- blocked_ref))
- if blocked_ref:
- log(phabdb.set_blocked_task(blocker_ref,
+ if upstream:
+ for b in upstream:
+ blocked_ref = extref(b)
+ log("%s is blocking %s" % (blocker_ref,
+ blocked_ref))
+ if blocked_ref:
+ log(phabdb.set_blocked_task(blocker_ref,
blocked_ref))
- else:
- log('%s is missing blocker %s' % (blocked_ref,
+ else:
+ log('%s is missing blocker %s' % (blocked_ref,
blocker_ref))
-
blocks = phabdb.get_tasks_blocked(blocker_ref)
vlog('%s is blocking %s' % (blocker_ref, str(blocks)))
+
current = pmig.sql_x("SELECT * \
from task_relations \
WHERE id = %s", bugid)