GithubHelp home page GithubHelp logo

macieka / bitbucket-issue-migration Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jeffwidman/bitbucket-issue-migration

0.0 1.0 0.0 154 KB

A small script for migrating repo issues from Bitbucket to GitHub

License: GNU General Public License v3.0

Python 100.00%

bitbucket-issue-migration's Introduction

Bitbucket Issues Migration

This is a small script that will migrate Bitbucket issues to a GitHub project.

It will import issues (and close them as needed) and their comments. Repositories can be public or private, owned by individuals or organizations. Labels and milestones are supported.

Before running:

Requires Python 3 and the requests library. keyring is an optional dependency if you want to pull login credentials from the system keyring.

It's probably easiest to install the dependencies using Python 3's built-in venv tool:

$ python3 -m venv ./py3
$ source ./py3/bin/activate
$ pip3 install -r requirements.pip

On Windows, use .\py3\Scripts\activate.bat instead of source ./py3/bin/activate

Parameters:

$ python3 migrate.py -h
usage: migrate.py [-h] [-bu BITBUCKET_USERNAME] [-n] [-f SKIP] [-m _MAP_USERS]
                  bitbucket_repo github_repo github_username

A tool to migrate issues from Bitbucket to GitHub.

positional arguments:
  bitbucket_repo        Bitbucket repository to pull issues from.
                        Format: <user or organization name>/<repo name>
                        Example: jeffwidman/bitbucket-issue-migration

  github_repo           GitHub repository to add issues to.
                        Format: <user or organization name>/<repo name>
                        Example: jeffwidman/bitbucket-issue-migration

  github_username       Your GitHub username. This is used only for
                        authentication, not for the repository location.

optional arguments:
  -h, --help            show this help message and exit

  -bu BITBUCKET_USERNAME, --bb-user BITBUCKET_USERNAME
                        Your Bitbucket username. This is only necessary when
                        migrating private Bitbucket repositories.

  -n, --dry-run         Simulate issue migration to confirm issues can be
                        extracted from Bitbucket and converted by this script.
                        Nothing will be copied to GitHub.

  -f SKIP, --skip SKIP  The number of Bitbucket issues to skip. Note that if
                        Bitbucket issues were deleted, they are already
                        automatically skipped.

  -m _MAP_USERS, --map-user _MAP_USERS
                        Override user mapping for usernames, for example
                        `--map-user fk=fkrull`. Can be specified multiple
                        times.

  --skip-attribution-for BB_SKIP
                        BitBucket user who doesn't need comments re-
                        attributed. Useful to skip your own comments, because
                        you are running this script, and the GitHub comments
                        will be already under your name.

  --link-changesets     Link changeset references back to BitBucket.

$ python3 migrate.py <bitbucket_repo> <github_repo> <github_username>

Example:

For example, to export the SQLAlchemy issue tracker to the repo https://github.com/jeffwidman/testing:

$ python3 migrate.py zzzeek/sqlalchemy jeffwidman/testing jeffwidman

Additional notes:

  • GitHub labels are created that map to the Bitbucket issue's priority, kind (bug, task, etc), component (if any, custom to each project), and version (if any). If you don't want these, just delete the new GitHub labels post-migration. (Note: GitHub limits label length to 50 characters. Labels longer than this will be truncated.)

  • Milestones are transferred. If the milestone doesn't exist in GitHub, it will be created. If you don't want this, either edit the code (search for "milestone") or delete the milestones in GitHub after the migration.

  • The migrated issues and issue comments are annotated with both Bitbucket and GitHub links to user who authored the comment/issue. This assumes the user reused their Bitbucket username on GitHub.

  • Within the body of issues and issue comments, hyperlinks to other issues in this Bitbucket repo will be rewritten as #<ID>, which GitHub will automatically hyperlink to the GitHub issue with that particular ID. This assumes that you are migrating to a GitHub repository that has no existing issues, otherwise the imported issues will have a different ID on GitHub than on Bitbucket and the links will be incorrect. If you are migrating to a GitHub repo with existing issues, just edit the code to offset the imported issue IDs by the correct amount.

  • This script is not idempotent--re-running it will leave the first set of imported issues intact, and then create a duplicate set of imported issues after the first set. If you want to re-run the import, it's best to delete your GitHub repo and start over so that the GitHub issue IDs start from 1.

  • The maximum allowable size per individual issue is 1MB. This limit is imposed by GitHub's Import API.

  • If your GitHub account uses 2-factor authentication, to access private GitHub repositories the tool instructs you to generate a token. You will need permissions repo and write:discussion.

Currently maintained by Jeff Widman. Originally written and open-sourced by Vitaly Babiy.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.