bitbucket-issue-migration
bitbucket-issue-migration copied to clipboard
Import crashes due to name clash between default labels and imported labels
We use a label called "documentation" but github repos by default contain a "Documentation" label.
This lead to a crash when an issue with a "documentation" label on bitbucket was attempted to be imported. It took me a long time to debug this but now I just figured it out and remove the default labels and the import works!
Imo the importer should delete all pre-existing labels before starting, if this is possible through the API, just to prevent these unforseeable collisions because it can happen otherwise with a fresh repo and that is something I consider rather unexpected as a user.
For reference, here is the crash log with trace:
Completed 204 issues Traceback (most recent call last): File "A:\Programs\PyCharm\helpers\pydev\pydevd.py", line 2411, in
globals = debugger.run(setup['file'], None, None, is_module) File "A:\Programs\PyCharm\helpers\pydev\pydevd.py", line 1802, in run launch(file, globals, locals) # execute the script File "A:\Programs\PyCharm\helpers\pydev_pydev_imps_pydev_execfile.py", line 18, in execfile exec(compile(contents+"\n", file, 'exec'), glob, loc) File "C:/Users/Lukas/PycharmProjects/bitbucket_migrate/migrate/migrate.py", line 877, in sys.exit(main(options)) File "C:/Users/Lukas/PycharmProjects/bitbucket_migrate/migrate/migrate.py", line 255, in main resp = verify_github_issue_import_finished( File "C:/Users/Lukas/PycharmProjects/bitbucket_migrate/migrate/migrate.py", line 862, in verify_github_issue_import_finished raise RuntimeError( RuntimeError: Failed to import GitHub issue due to the following errors: {'id': 2725386, 'status': 'failed', 'url': 'https://api.github.com/repos/Ident/ceguiissuetest/import/issues/2725386', 'import_issues_url': 'https://api.github.com/repos/Ident/ceguiissuetest/import/issues', 'repository_url': 'https://api.github.com/repos/Ident/ceguiissuetest', 'created_at': '2020-01-05T13:35:06.000+01:00', 'updated_at': '2020-01-05T13:35:06.000+01:00', 'errors': [{'location': '/issue/labels[1]', 'resource': 'Label', 'field': 'name', 'value': 'Documentation', 'code': 'invalid'}]}
I hesitate to delete pre-existing labels. I'd rather we catch the error of conflicting labels and notify the user with a clear error message. Then the user can either delete the offending label in github, or modify the script to rename the conflicting bitbucket label during import.
Want to submit a PR?