Giter VIP home page Giter VIP logo

gcit2ghi's Introduction

gcit2ghi.rb

This is a simple script to convert from Google Code Issue Tracker to GitHub Issues.

Usage

ruby gcit2ghi.rb project user password owner repo

project - Google Code project
user - GitHub user name
password - GitHub user password
owner - Repository's owner's username on GitHub (ensures compatibility with personal and organization-owned repos)
repo - Repository name
max-results - (optional) Maximum tickets and maximum comments to fetch (defaults is 500) (disabled for debugging)

###Usage Examples ruby gcit2ghi.rb beef joe super-secret joe my-beef - fetches 500 oldest tickets and 500 oldest comments per ticket from Google Code project Beef and appends them to GitHub repo joe/my-beef using the password super-secret.

ruby gcit2ghi.rb beef joe super-secret joes-org our-beef - fetches 500 oldest tickets and 500 oldest comments per ticket from Google Code project Beef and appends them to GitHub repo joes-org/our-beef on behalf of user joe using the password super-secret.

ruby gcit2ghi.rb beef joe super-secret joe my-beef 25 - fetches 25 oldest tickets and 25 oldest comments per ticket from Google Code project Beef and appends them to GitHub repo joe/my-beef using the password super-secret.

Requirements

  1. ruby - Programming language (find installer for your OS)
  2. rubygems - Gem management package for Ruby (installation instructions)
  3. nokogiri - For parsing the Google Code XML files (open console/terminal/command prompt and execute gem install nokogiri)
  4. json - For serializing the GitHub API calls (open console/terminal/command prompt and execute gem install json)
  5. rest-client - For submitting the GitHub API calls (open console/terminal/command prompt and execute gem install rest-client)

How It Works

  1. Downloads the Issue Tracker feed from Google Code (caching it locally in the created xml subdirectory). Parses out all issues.
  2. For each issue, downloads the Issue Comments feed from Google Code (caching it locally) and parses out all comments for the issue as long as they aren't empty (e.g., Google Code marks label changes as comments).
  3. Does some preprocessing of the parsed out entries to add to the body of issues and comments adding the valuable reference information:
  • link to the original Google Code issue and its ID number there
  • anonymized author of the issue & each comment on Google Code (email domain is truncated because GitHub automatically converts them into mailto: links)
  • the creation and the closure date of the issue
  1. Uploads each issue to GitHub, potentially marks the issue as closed if it was closed on Google Code, and uploads each comment related to the issue.

Caveats

If you want to import more/fewer than 500 tickets or comments per ticket you need to edit the script manually. Global constant MAX_RESULTS on line 14 is responsible for that.

There is very little error handling done. There are only basic comments in the source code (whatever I, dnbrv, added or was able to understand in the original code).

Files uploaded to Google Code (aka attachments) are not copied. This is a limitation of Google Code Issue Tracker API.

Labels and milestones are not copied, only the title and body of issues and the body of comments.

Tickets are imported without assignee by default. If you want to assign them to someone automatically, see line 81 of the script for instructions.

There's no way to delete existing tickets from GitHub either manually or via API. If you botch-up a migration, you'll have to delete and re-create the repo on GitHub. DO NOT ATTEMPT THIS if you don't know what you're doing. Tip: make sure your local copy of the repo is up-to-date and secured before deleting the remote one.

This was used to convert the ruby-sequel Google Code issues to jeremyevans/sequel on GitHub. Jeremy has stopped development since then so Denis Baranov made some improvements to transition 7plus.

License

This code is licensed under the MIT license. See the MIT-LICENSE.md file for details.

Authors

Jeremy Evans [email protected] - original author
Denis Baranov [email protected] - author of this fork

Whishlist

  • A relatively simple way to migrate labels and milestones (it can't be very simple because of Google Code treats everything as labels and GitHub throws an error when a label doesn't exist, which requires either a label creation sub-routine or renaming labels prior to import).
  • Allowing users set the number of tickets to import in console not file.
  • Checking for existing tickets in GitHub and prompting users to overwrite them (i.e., fix a prematurely-stopped migration).

gcit2ghi's People

Watchers

 avatar

Forkers

gunpowderlabs

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.