Skip to content

Support bitbucket priorities #135

@sapr9x3

Description

@sapr9x3

Hello.
I was thinking about that is not a bad idea to have an ability to migrate isuues priorities from bitbucket to github.
I did it.
I made labels in my github repository: prio:trivial, prio:minor, prio:major, prio:critical, prio:blocker.

Then I just added to config.py

# We map bitbucket's issue "priority" to github "labels".
PRIORITY_MAPPING = {
    "trivial": "prio:trivial",
    "minor": "prio:minor",
    "major": "prio:major",
    "critical": "prio:critical",
    "blocker": "prio:blocker"
}

and to bitbucket_issues_to_github.py

def map_bpriority_to_glabels(bissue, glabels):
    bpriority = bissue['priority']
    if bpriority in config.PRIORITY_MAPPING:
        glabels.add(config.PRIORITY_MAPPING[bpriority])
...
...
def patch_gissue(gissue, bissue, bexport):
    if gissue['title'] != bissue['title']:
        raise ValueError('Inconsistent issues')

    glabels = set()
    map_bkind_to_glabels(bissue=bissue, glabels=glabels)
    map_bstatus_to_glabels(bissue=bissue, glabels=glabels)
    map_bpriority_to_glabels(bissue=bissue, glabels=glabels)  # <-this  

    gissue_patch = {
        "body": construct_gissue_content(bissue=bissue, bexport=bexport),
        "assignees": map_bassignee_to_gassignees(bissue=bissue),
        "labels": list(glabels),
        "state": map_bstatus_to_gstate(bissue=bissue),
    }
...

I can make a PR if this idea is really good.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions