Giter Club home page Giter Club logo

github-to-bitbucket-issues-migration's Introduction

Export issues from a Github repository to the Bitbucket Issue Data Format

Usage

Requirements:

Make sure you have all dependencies:

bundle install

And then:

  ruby cli.rb -u username -p password -r myrepo -o issues.zip

or:

  ruby cli.rb -t token_here --organization your_org

Available options

    -t, --access_token [ARG]         Github access token
    -u, --username [ARG]             Github username
    -p, --password [ARG]             Github password
        --organization [ARG]         Export all organization's repositories
    -o, --output [ARG]               Output filename - defaults to [repo_name].zip
    -r, --repository [ARG]           Export only one repository
    -h, --help                       Show this message

github-to-bitbucket-issues-migration's People

Contributors

lakelse avatar milieu avatar orian avatar sorich87 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

github-to-bitbucket-issues-migration's Issues

Requires a repo in format user/repo

-r option must in in format user/repo (I guess it's an effect of some underlying library changes)

-r user/repo

one has to create a dir (side effect of changing -r option format?):

mkdir user

Error: 401 - Must specify two-factor authentication OTP code

I run this command in bash:

$ ruby cli.rb -t 'personal_gh_access_token' -u 'gh_username' -p 'gh_password' -o 'export_filename.zip' -r 'gh_username/repo'

where is personal_gh_access_token created at this URL: https://github.com/settings/tokens. It is called "git: https://github.com/ on HOPE-PC at 23-oct.-2016 13:35" and it was regenerated by me today with all the available permissions enabled.

The output of the command is this (it is the same as running it with sudo):

Fetch gh_username/repo
Error fetching data from github GET https://api.github.com/repos/gh_username/repo/issues?page=1&state=open: 401 - Must specify two-factor authentication OTP code. // See: https://developer.github.com/v3/auth#working-with-two-factor-authentication

This is either a bug, or an undocumented behavior. If I disable the two-factor authentication on my GitHub account, everything works well.

SSLv3 read server certificate B: certificate verify failed (Faraday::SSLError)

Got this error when attempting to use this.

c:/Ruby22-x64/lib/ruby/2.2.0/net/http.rb:923:in `connect': SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (Faraday::SSLError)
        from c:/Ruby22-x64/lib/ruby/2.2.0/net/http.rb:923:in `block in connect'
        from c:/Ruby22-x64/lib/ruby/2.2.0/timeout.rb:74:in `timeout'
        from c:/Ruby22-x64/lib/ruby/2.2.0/net/http.rb:923:in `connect'
        from c:/Ruby22-x64/lib/ruby/2.2.0/net/http.rb:863:in `do_start'
        from c:/Ruby22-x64/lib/ruby/2.2.0/net/http.rb:852:in `start'
        from c:/Ruby22-x64/lib/ruby/2.2.0/net/http.rb:1375:in `request'
        from c:/Ruby22-x64/lib/ruby/2.2.0/net/http.rb:1133:in `get'
        from c:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/faraday-0.9.1/lib/faraday/adapter/net_http.rb:80:in `perform_request'
        from c:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/faraday-0.9.1/lib/faraday/adapter/net_http.rb:40:in `block in call'
        from c:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/faraday-0.9.1/lib/faraday/adapter/net_http.rb:87:in `with_net_http_connection'
        from c:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/faraday-0.9.1/lib/faraday/adapter/net_http.rb:32:in `call'
        from c:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/faraday-0.9.1/lib/faraday/response.rb:8:in `call'
        from c:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/faraday-0.9.1/lib/faraday/response.rb:8:in `call'
        from c:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/faraday-0.9.1/lib/faraday/rack_builder.rb:139:in `build_response'
        from c:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/faraday-0.9.1/lib/faraday/connection.rb:377:in `run_request'
        from c:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/faraday-0.9.1/lib/faraday/connection.rb:140:in `get'
        from c:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/sawyer-0.6.0/lib/sawyer/agent.rb:94:in `call'
        from c:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/octokit-3.8.0/lib/octokit/client.rb:339:in `request'
        from c:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/octokit-3.8.0/lib/octokit/client.rb:200:in `paginate'
        from c:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/octokit-3.8.0/lib/octokit/client/issues.rb:31:in `list_issues'
        from c:/Users/James/github-to-bitbucket-issues-migration/lib/github-to-bitbucket-issues/downloaders/base.rb:17:in `block in fetch'
        from c:/Users/James/github-to-bitbucket-issues-migration/lib/github-to-bitbucket-issues/downloaders/base.rb:15:in `loop'
        from c:/Users/James/github-to-bitbucket-issues-migration/lib/github-to-bitbucket-issues/downloaders/base.rb:15:in `fetch'
        from c:/Users/James/github-to-bitbucket-issues-migration/lib/github-to-bitbucket-issues/export.rb:105:in `download_all_of'
        from c:/Users/James/github-to-bitbucket-issues-migration/lib/github-to-bitbucket-issues/export.rb:92:in `block in download_issues'
        from c:/Users/James/github-to-bitbucket-issues-migration/lib/github-to-bitbucket-issues/export.rb:91:in `each'
        from c:/Users/James/github-to-bitbucket-issues-migration/lib/github-to-bitbucket-issues/export.rb:91:in `download_issues'
        from c:/Users/James/github-to-bitbucket-issues-migration/lib/github-to-bitbucket-issues/export.rb:51:in `block in generate'
        from c:/Users/James/github-to-bitbucket-issues-migration/lib/github-to-bitbucket-issues/export.rb:38:in `each'
        from c:/Users/James/github-to-bitbucket-issues-migration/lib/github-to-bitbucket-issues/export.rb:38:in `generate'
        from cli.rb:51:in `<main>'
$ ruby -v
ruby 2.2.2p95 (2015-04-13 revision 50295) [x64-mingw32]

Parse Error

I am getting following parse error when retrieving issuer:

705 retrieved
Processing issue 8
Status:
Priority: minor
Type:
Milestone:
/usr/local/Cellar/ruby/1.9.3-p194/lib/ruby/1.9.1/json/common.rb:148:in parse': 743: unexpected token at 'Resource not found' (JSON::ParserError) from /usr/local/Cellar/ruby/1.9.3-p194/lib/ruby/1.9.1/json/common.rb:148:inparse'
from /Users/knyttl/Downloads/github-to-bitbucket-issues-migration/migration.rb:193:in open_issue' from /Users/knyttl/Downloads/github-to-bitbucket-issues-migration/migration.rb:91:inupload_issue'
from /Users/knyttl/Downloads/github-to-bitbucket-issues-migration/migration.rb:68:in block in upload_issues' from /Users/knyttl/Downloads/github-to-bitbucket-issues-migration/migration.rb:68:ineach'
from /Users/knyttl/Downloads/github-to-bitbucket-issues-migration/migration.rb:68:in upload_issues' from /Users/knyttl/Downloads/github-to-bitbucket-issues-migration/migration.rb:19:inperform!'
from cli.rb:4:in `

'

Error when I try to use it

I've only changed the names of users and repos to generic one, but while I run this command, I use real username and repo names, and error is below:

Thanks if you can fix this issue.

bundle exec ruby cli.rb githubuser/repo bitbucketuser/repo

cli.rb:1:in `require': ./migration.rb:33: syntax error, unexpected ':', expecting ')' (SyntaxError)
login: @github[:username],
^
./migration.rb:34: syntax error, unexpected ':', expecting '='
password: @github[:password]
^
./migration.rb:35: syntax error, unexpected ')', expecting kEND
./migration.rb:42: odd number list for Hash
@history[@github_repo] = {issue: {}, comment: {}}
^
./migration.rb:42: syntax error, unexpected ':', expecting '}'
@history[@github_repo] = {issue: {}, comment: {}}
^
./migration.rb:54: odd number list for Hash
state: state,
^
./migration.rb:54: syntax error, unexpected ':', expecting '}'
state: state,
^
./migration.rb:55: syntax error, unexpected ':', expecting '='
page: page,
^
./migration.rb:56: syntax error, unexpected ':', expecting '='
direction: 'asc'
^
./migration.rb:57: syntax error, unexpected '}', expecting kEND
})
^
./migration.rb:86: syntax error, unexpected ':', expecting ')'
status: get_issue_status(issue),
^
./migration.rb:86: syntax error, unexpected ',', expecting kEND
./migration.rb:87: syntax error, unexpected ',', expecting kEND
./migration.rb:89: syntax error, unexpected ':', expecting '='
content: content,
^
./migration.rb:90: syntax error, unexpected ':', expecting '='
kind: get_issue_kind(issue),
^
./migration.rb:90: syntax error, unexpected ',', expecting kEND
./migration.rb:92: syntax error, unexpected ')', expecting kEND
./migration.rb:165: odd number list for Hash
content: content
^
./migration.rb:165: syntax error, unexpected ':', expecting '}'
content: content
^
./migration.rb:189: odd number list for Hash
body: attributes,
^
./migration.rb:189: syntax error, unexpected ':', expecting '}'
body: attributes,
^
./migration.rb:190: syntax error, unexpected ':', expecting '='
basic_auth: @bitbucket
^
./migration.rb:193: syntax error, unexpected ':', expecting ')'
body = JSON.parse(response.body, symbolize_names: true)
^
./migration.rb:201: odd number list for Hash
body: attributes,
^
./migration.rb:201: syntax error, unexpected ':', expecting '}'
body: attributes,
^
./migration.rb:202: syntax error, unexpected ':', expecting '='
basic_auth: @bitbucket
^
./migration.rb:205: syntax error, unexpected ':', expecting ')'
body = JSON.parse(response.body, symbolize_names: true)
^
./migration.rb:208: syntax error, unexpected $end, expecting kEND
from cli.rb:1

Support for Ruby 1.8

It's the default on widely used systems like OS X and CentOS an supporting it is very small work (only hash syntax change I think).

Use Bitbucket's new issue import archive format

We've added proper issue import and export to Bitbucket. You can export an entire repo's issue tracker as a zip file and then re-import on a different repo.

You can also create your own zips and so you could write very migration scripts to and from other issue trackers (e.g. GitHub).

Details: https://confluence.atlassian.com/display/BITBUCKET/Export+or+Import+Issue+Data

File format and data layout: https://confluence.atlassian.com/pages/viewpage.action?pageId=330796872

Importing Closed Issues

I'm running through the .jason output and I'm not seeing any of the "closed" issues. Is this possible with a special option?

Awesome piece of code by the way, thank you!

Correct README markdown

It contains (https://confluence.atlassian.com/display/BITBUCKET/Export+or+Import+Issue+Data)[Bitbucket Issue Data Format]: (link)[description] while correct markdown is [description](link).

Create Milestones for closed issues

The json export file only defines milestone names that appear against open issues.
It would be helpful if the milestone values for closed issues could also be included in the json.
Depending on the number of milestones you have it may be a simple enough workaround to add these to the bottom of the unzipped json file before re-zipping it for import (I happen to have 68 closed milestones).

Create milestones

At this point, it displays an error if milestones don't exist on Bitbucket and you need to create them manually. It would be good if they were created via the API.

Match users

Allow setting a list of usernames to match between Github and Bitbucket

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.