示例#1
0
from github import Github
import getpass

u = raw_input("Github username: "******"Password: "******"TRAC_TO_GITHUB_USERS.txt", "w")
    names = get_ticket_owners() + get_ticket_reporters() + get_ticket_ccs()
    import collections
    counts = collections.Counter(names)
    cn = [(c, n) for n, c in counts.iteritems()]
    cn.sort()
    cn.reverse()
    for c, n in cn:
        if c > 1:
            tracemail = util.trac_user_email(n)
            ghuser = util.trac_email_to_github(tracemail)
            if ghuser is None and '@' in tracemail:
                try:
                    ghuser = g.legacy_search_user_by_email(tracemail).login
                except:
                    pass
            if ghuser is not None:
                outf.write("%s %s\n" % (n, ghuser))
                outf.flush()
            else:
                print "MISSING", n, tracemail, c
# Check that ticket owners are in EMAIL_TO_GITHUB.txt map
import util

def get_ticket_owners():
    c = util.cursor()
    return [v[0] for v in c.execute("SELECT owner FROM ticket").fetchall()]

def get_ticket_reporters():
    c = util.cursor()
    return [v[0] for v in c.execute("SELECT reporter FROM ticket").fetchall()]

def get_ticket_ccs():
    c = util.cursor()
    return [s.strip() for v in c.execute("SELECT cc FROM ticket").fetchall() for s in v[0].split(",") if s != ""]

if __name__ == '__main__':
    names = get_ticket_owners() + get_ticket_reporters() + get_ticket_ccs()
    import collections
    counts = collections.Counter(names)
    cn = [(c, n) for n, c in counts.iteritems()]
    cn.sort()
    cn.reverse()
    for c, n in cn:
        if c > 1:
            if util.trac_email_to_github(util.trac_user_email(n)) is None and util.trac_user_to_github(n) is None:
                print "MISSING", n, util.trac_user_email(n), c
u = raw_input("Github username: "******"Password: "******"TRAC_TO_GITHUB_USERS.txt", "w")
    names = get_ticket_owners() + get_ticket_reporters() + get_ticket_ccs()
    import collections
    counts = collections.Counter(names)
    cn = [(c, n) for n, c in counts.iteritems()]
    cn.sort()
    cn.reverse()
    for c, n in cn:
        if c > 1:
            tracemail = util.trac_user_email(n)
            if tracemail is None:
                continue
            ghuser = util.trac_email_to_github(tracemail)
            if ghuser is None and '@' in tracemail:
                try:
                    ghuser = g.legacy_search_user_by_email(tracemail).login
                except:
                    pass
            if ghuser is not None:
                outf.write("%s %s\n" % (n, ghuser))
                outf.flush()
            else:
                print "MISSING", n, tracemail, c
示例#4
0
def get_ticket_owners():
    c = util.cursor()
    return [v[0] for v in c.execute("SELECT owner FROM ticket").fetchall()]


def get_ticket_reporters():
    c = util.cursor()
    return [v[0] for v in c.execute("SELECT reporter FROM ticket").fetchall()]


def get_ticket_ccs():
    c = util.cursor()
    return [
        s.strip() for v in c.execute("SELECT cc FROM ticket").fetchall()
        for s in v[0].split(",") if s != ""
    ]


if __name__ == '__main__':
    names = get_ticket_owners() + get_ticket_reporters() + get_ticket_ccs()
    import collections
    counts = collections.Counter(names)
    cn = [(c, n) for n, c in counts.iteritems()]
    cn.sort()
    cn.reverse()
    for c, n in cn:
        if c > 1:
            if util.trac_email_to_github(util.trac_user_email(
                    n)) is None and util.trac_user_to_github(n) is None:
                print "MISSING", n, util.trac_user_email(n), c