def reorder(first, start, end, placeholder=300001): #pmig = phabdb.phdb(db=config.bzmigrate_db, # user=config.bzmigrate_user, # passwd=config.bzmigrate_passwd) # range of issues to renumber issues = range(int(start), int(end) + 1) first_issue = issues[0] # number to start new linear renumber at newid = int(first) print 'starting renumbering at %s with %s' % (first, first_issue) pphid = phabdb.get_task_phid_by_id(placeholder) if pphid: print "placeholder %s not empty (%s)" % (placeholder, pphid) return for t in issues: print "Reassigning reference: %s to %s" % (t, newid) # Find PHID of the first ticket in our lineup ref = bzlib.prepend + str(t) phid = phabdb.reference_ticket(ref) if len(phid) > 1 or not phid: newid += 1 print 'skipping phid %s' % (ref,) continue else: refphid = phid[0] print "Reference %s is %s" % (ref, refphid) tid = phabdb.get_task_id_by_phid(refphid) print "Reference %s is starting at id %s" % (ref, tid) existing_task = phabdb.get_task_phid_by_id(int(newid)) print "Existing task returns %s" % (existing_task,) if existing_task: print "Squatter task at %s is %s" % (newid, existing_task) print "Moving squatter %s to %s" % (existing_task, placeholder) phabdb.set_task_id(placeholder, existing_task) phabdb.set_task_id(newid, refphid) if existing_task: print "fixup setting squatter %s to %s" % (existing_task, tid) phabdb.set_task_id(tid, existing_task) newid += 1
import os, sys path = os.path.dirname(os.path.abspath(__file__)) sys.path.append('/'.join(path.split('/')[:-1])) from wmfphablib import phabdb from wmfphablib import util policyPHID = phabdb.create_policy(allowedUSERS=["PHID-USER-qjvgbwgjbko3uqjd6qxs","PHID-USER-3bhvz52nbc2bblxj6tz5","PHID-USER-5c7hmjvo4ncll374kjpm"], allowedProjects=["PHID-PROJ-xdhc4tn6wzks6xaz5pwq"]) print policyPHID taskPHID = phabdb.get_task_phid_by_id(100039) print taskPHID phabdb.set_task_policy(taskPHID, policyPHID) #print util.remove_issue_by_bugid(sys.argv[1], 'rt') exit() email_tuples = phabdb.get_verified_emails() flat_list = [e[1] for e in email_tuples] print ','.join(flat_list) exit() print phabdb.set_tasks_blocked('PHID-TASK-llxzmfbbcc4adujigg4w', 'PHID-TASK-cjibddnd5lsa5n5hdsyx') #print phabdb.get_blocking_tasks('PHID-TASK-llxzmfbbcc4adujigg4w') #print phabdb.phid_by_custom_field('fl563') print 'email', phabdb.email_by_userphid('PHID-USER-nnipdbdictreyx7qhaii') #get the comment transactions by task coms = phabdb.comment_transactions_by_task_phid('PHID-TASK-3eivod3do3vzdviblbfr') final_comments = {} for i, c in enumerate(coms): comdetail = {} comdetail['userphid'] = c[3]