Esempio n. 1
0
github = GitHub(github_username, github_password, github_repo)

# Show the Trac usernames assigned to tickets as an FYI

logging.info("Getting Trac ticket owners (will NOT be mapped to GitHub username)...")
for (username,) in trac.sql('SELECT DISTINCT owner FROM ticket'):
    if username:
        username = username.strip() # username returned is tuple like: ('phred',)
        logging.debug("Trac ticket owner: %s" % username)


# Get GitHub labels; we'll merge Trac components and other values into them

logging.info("Getting existing GitHub labels...")
labels = {}
for label in github.labels():
    labels[label['name']] = label['url'] # ignoring 'color'
    logging.debug("label name=%s" % label['name'])

# Get any existing GitHub milestones so we can merge Trac into them.
# We need to reference them by numeric ID in tickets.
# API returns only 'open' issues by default, have to ask for closed like:
# curl -u 'USER:PASS' https://api.github.com/repos/USERNAME/REPONAME/milestones?state=closed

logging.info("Getting existing GitHub milestones...")
milestone_id = {}
for m in github.milestones():
    milestone_id[m['title']] = m['number']
    logging.debug("milestone (open)   title=%s" % m['title'])
for m in github.milestones(query='state=closed'):
    milestone_id[m['title']] = m['number']
github = GitHub(github_username, github_password, github_repo)

# Show the Trac usernames assigned to tickets as an FYI

logging.info("Getting Trac ticket owners (will NOT be mapped to GitHub username)...")
for (username,) in trac.sql('SELECT DISTINCT owner FROM ticket'):
    if username:
        username = username.strip() # username returned is tuple like: ('phred',)
        logging.debug("Trac ticket owner: %s" % username)


# Get GitHub labels; we'll merge Trac components into them

logging.info("Getting existing GitHub labels...")
labels = {}
for label in github.labels():
    labels[label['name']] = label['url'] # ignoring 'color'
    logging.debug("label name=%s" % label['name'])

# Get any existing GitHub milestones so we can merge Trac into them.
# We need to reference them by numeric ID in tickets.
# API returns only 'open' issues by default, have to ask for closed like:
# curl -u 'USER:PASS' https://api.github.com/repos/USERNAME/REPONAME/milestones?state=closed

logging.info("Getting existing GitHub milestones...")
milestone_id = {}
for m in github.milestones():
    milestone_id[m['title']] = m['number']
    logging.debug("milestone (open)   title=%s" % m['title'])
for m in github.milestones(query='state=closed'):
    milestone_id[m['title']] = m['number']
trac = Trac(trac_db_path)
github = GitHub(github_username, github_password, github_repo)

# Show the Trac usernames assigned to tickets as an FYI

logging.info("Getting Trac ticket owners (will NOT be mapped to GitHub username)...")
for (username,) in trac.sql('SELECT DISTINCT owner FROM ticket WHERE component="%s"' % trac_component):
    if username:
        username = username.strip()  # username returned is tuple like: ('phred',)
        logging.debug("Trac ticket owner: %s" % username)

# Get GitHub labels; we'll merge Trac priorities and types into them

logging.info("Getting existing GitHub labels...")
gh_labels = {}
for label in github.labels():
    gh_labels[label["name"]] = True
    logging.debug("label name=%s" % label["name"])

if options.milestones:
    # Get any existing GitHub milestones so we can merge Trac into them.
    # We need to reference them by numeric ID in tickets.
    # API returns only 'open' issues by default, have to ask for closed like:
    # curl -u 'USER:PASS' https://api.github.com/repos/USERNAME/REPONAME/milestones?state=closed

    logging.info("Getting existing GitHub milestones...")
    milestone_id = {}
    for m in github.milestones():
        milestone_id[m["title"]] = m["number"]
        logging.debug("milestone (open)   title=%s" % m["title"])
    for m in github.milestones(query="state=closed"):
Esempio n. 4
0
logging.info(
    "Getting Trac ticket owners (will NOT be mapped to GitHub username)...")
for (username, ) in trac.sql(
        'SELECT DISTINCT owner FROM ticket WHERE component="%s"' %
        trac_component):
    if username:
        username = username.strip(
        )  # username returned is tuple like: ('phred',)
        logging.debug("Trac ticket owner: %s" % username)

# Get GitHub labels; we'll merge Trac priorities and types into them

logging.info("Getting existing GitHub labels...")
gh_labels = {}
for label in github.labels():
    gh_labels[label['name']] = True
    logging.debug("label name=%s" % label['name'])

if options.milestones:
    # Get any existing GitHub milestones so we can merge Trac into them.
    # We need to reference them by numeric ID in tickets.
    # API returns only 'open' issues by default, have to ask for closed like:
    # curl -u 'USER:PASS' https://api.github.com/repos/USERNAME/REPONAME/milestones?state=closed

    logging.info("Getting existing GitHub milestones...")
    milestone_id = {}
    for m in github.milestones():
        milestone_id[m['title']] = m['number']
        logging.debug("milestone (open)   title=%s" % m['title'])
    for m in github.milestones(query='state=closed'):
trac = Trac(trac_db_path)
github = GitHub(github_username, github_password, github_repo)

# Show the Trac usernames assigned to tickets as an FYI

logging.info("Getting Trac ticket owners (will NOT be mapped to GitHub username)...")
for (username,) in trac.sql('SELECT DISTINCT owner FROM ticket WHERE component="%s"' % trac_component):
    if username:
        username = username.strip() # username returned is tuple like: ('phred',)
        logging.debug("Trac ticket owner: %s" % username)

# Get GitHub labels; we'll merge Trac priorities and types into them

logging.info("Getting existing GitHub labels...")
gh_labels = {}
for label in github.labels():
    gh_labels[label['name']] = True
    logging.debug("label name=%s" % label['name'])

if options.milestones:
    # Get any existing GitHub milestones so we can merge Trac into them.
    # We need to reference them by numeric ID in tickets.
    # API returns only 'open' issues by default, have to ask for closed like:
    # curl -u 'USER:PASS' https://api.github.com/repos/USERNAME/REPONAME/milestones?state=closed

    logging.info("Getting existing GitHub milestones...")
    milestone_id = {}
    for m in github.milestones():
        milestone_id[m['title']] = m['number']
        logging.debug("milestone (open)   title=%s" % m['title'])
    for m in github.milestones(query='state=closed'):