Пример #1
0
def remove_issue_by_bugid(bugid, ref):
    log("Removing issue by reference %s%s" % (ref, bugid))
    taskphid = phabdb.reference_ticket("%s%s" % (ref, bugid))
    log("Removing issue by taskphid %s" % (taskphid,))
    if len(taskphid) < 1:
        return 'no task phid found to remove'
    issueid = phabdb.get_task_id_by_phid(taskphid[0])
    notice("!Removing issue T%s!" % (issueid,))
    out = ''
    out += destroy_issue(issueid)
    out += str(phabdb.remove_reference("%s%s" % (ref, bugid)))
    out += str(phabdb.reference_ticket("%s%s" % (ref, bugid)))
    return out
Пример #2
0
 def sync_assigned(self, userphid, id, prepend):
     refs = phabdb.reference_ticket('%s%s' % (prepend, id))
     if not refs:
         log('reference ticket not found for %s' % ('%s%s' % (prepend, id),))
         return
     current = self.con.maniphest.query(phids=[refs[0]])
     if current[current.keys()[0]]['ownerPHID']:
         log('current owner found for => %s' % (str(id),))
         return current
     log('assigning T%s to %s' % (str(id), userphid))
     return phabdb.set_issue_assigned(refs[0], userphid)
Пример #3
0
def bzbug_ref_translate(text):
    mentioned_bugs = find_bug_refs(text)
    phabrefs = {}
    for b in mentioned_bugs:
        bugint = re.search('\d+', b).group(0)
        reft = phabdb.reference_ticket('%s%s' % (bzlib.prepend, bugint))
        if reft:
            phabrefs[b] = reft
    refdict = {k: v[0] for k, v in phabrefs.iteritems() if v is not None}
    taskid = lambda x: phabdb.get_task_id_by_phid(x)
    newrefs = {k: "T%s" % (taskid(v),) for k, v in refdict.iteritems()}
    return replace_bug_refs(text, newrefs)
Пример #4
0
 def sync_assigned(self, userphid, id, prepend):
     refs = phabdb.reference_ticket('%s%s' % (prepend, id))
     if not refs:
         log('reference ticket not found for %s' % ('%s%s' %
                                                    (prepend, id), ))
         return
     current = self.con.maniphest.query(phids=[refs[0]])
     if current[current.keys()[0]]['ownerPHID']:
         log('current owner found for => %s' % (str(id), ))
         return current
     log('assigning T%s to %s' % (str(id), userphid))
     return phabdb.set_issue_assigned(refs[0], userphid)
Пример #5
0
    def synced_authored(self, phid, id, ref):
        refs = phabdb.reference_ticket('%s%s' % (ref, id))
        if not refs:
            log('reference ticket not found for %s' % ('%s%s' % (ref, id),))
            return
        log('reference ticket found for %s' % ('%s%s' % (ref, id),))
        newid = self.ticket_id_by_phid(refs[0])
        log("Updating author for %s to %s" % (refs, phid))
        phabdb.set_task_author(phid, newid)

        descript = phabdb.get_task_description(refs[0])
        try:
            clean_description = descript.split('**Description:**\n', 1)[1]
            phabdb.set_task_description(refs[0], clean_description)
        except:
            phabdb.set_task_description(refs[0], descript)
Пример #6
0
    def synced_authored(self, phid, id, ref):
        refs = phabdb.reference_ticket('%s%s' % (ref, id))
        if not refs:
            log('reference ticket not found for %s' % ('%s%s' % (ref, id), ))
            return
        log('reference ticket found for %s' % ('%s%s' % (ref, id), ))
        newid = self.ticket_id_by_phid(refs[0])
        log("Updating author for %s to %s" % (refs, phid))
        phabdb.set_task_author(phid, newid)

        descript = phabdb.get_task_description(refs[0])
        try:
            clean_description = descript.split('**Description:**\n', 1)[1]
            phabdb.set_task_description(refs[0], clean_description)
        except:
            phabdb.set_task_description(refs[0], descript)