PageRenderTime 47ms CodeModel.GetById 20ms RepoModel.GetById 0ms app.codeStats 0ms

/README.md

https://bitbucket.org/ckirby/git2bit
Markdown | 132 lines | 77 code | 55 blank | 0 comment | 0 complexity | e1586089e6007e39dd4a8b0c8bb1aaee MD5 | raw file
  1. # git2bit
  2. There are many people out there that have migrated their private repositories from Github to Bitbucket. Bitbucket has a goo utility that will clone your entire repository over, however, there is no way to migrate any existing issues that you have on Github.
  3. git2bit is a CLI that solves this by migrating all your issues along with their comments and milestones from Github into your new Bitbucket repo.
  4. **Important Tip**: I recommend that you create a new blank repo in Bitbucket to run intial migration tests with. Once you are happy with the migration results, you can delete this repository and proceed with migrating issues to the production repo.
  5. ## How does it work?
  6. The issues systems between Github and Bitbucket are similar but also pretty different. Github uses *labels* in order to get you to organize and categorize your issues. Bitbucket does not support labels and instead has a more traditional approach using a predefined set of fields.
  7. Obviously the issue title and body will come over unchanged. However, all of the migrated issues will be created by the Bitbucket user account that is configred in git2bit. The original creation date of the issue will not be migrated either. As a consolation, the original data from Github will be inserted at the top of the newly created issue.
  8. Github issue #459 created by joeworkman on 2012-09-06 20:51:49
  9. Here are some more caveats with each Bitbucket issue field.
  10. **Tip**: Chances are you already had labels in Github for organizing issues by kind, priority, or component. Before you migrate issues using git2bit, make sure that you rename your labels to maps to the supported Bitbucket fields documented below.
  11. ### Comments
  12. The first comment added to newly created issues will contain a list of all the Github labels that were assigned to the original ticket. This will ensure that you still have this data if its valuable to you.
  13. All comments from Github will be brought over and inserted into the new issue created on Bitbucket. Just like at the ticket level the creation data (username & date) will be inserted at the top of each comment.
  14. ### Kind
  15. Bitbucket supports 4 different kinds of issues: `bug`, `enhancement`, `proposal`, and `task`.
  16. git2bit will evaluate all of the labels that are assigned to each Github issue. If one of the labels matches the mentioned Bitbucket kinds, when the issue if created, it will be assigned to that kind. If no matching label is found, the issue will default to be a bug.
  17. ### Priority
  18. Bitbucket supports 5 different priorities for issues: `trivial`, `minor`, `major`, `critical`, and `blocker`.
  19. git2bit will evaluate all of the labels that are assigned to each Github issue. If one of the labels matches the mentioned Bitbucket priorities, when the issue if created, it will be assigned to that priority. If no matching label is found, the issue will default to the priority of trivial.
  20. ### Status
  21. Bitbucket supports 7 different priorities for issues: `new`, `open`, `resolved`, `on hold`, `invalid`, `duplicate`, and `wontfix`.
  22. This somewhat overlaps with Github issue status. In Github an issue can only ever be opened or closed. However, I know for a fact that developers use labels to get better fine-grained control over this. Therefore, git2bit evaluates the labels on each Github issue. If one of the labels matches the mentioned Bitbucket status options, when the issue if created, it will be assigned to that status. If no matching label is found, then the issue will be set to open.
  23. **Note**: The `closed` status in a Github issue will trump everything. In this case, the newly created issue will be set to `resolved` in Bitbucket.
  24. ### Component
  25. Bitbucket has support for manually defined components. If you would like for git2bit to populate this field for an issue, you will need to make sure that all of the Components are defined in your repository's Issues settings.
  26. git2bit will evaluate all of the labels that are assigned to each Github issue. If one of the labels matches a preconfigured Component, the newly created issue will be assigned to that Component. If no matching label is found, no Components will be assigned.
  27. **Note**: Bitbucket only allows an issue to be associated with one Component. Therefore, if you were using Github labels to assign multiple Components to an issue, when git2bit processes an issue, the first Component found within the labels wins.
  28. ### Milestone
  29. git2bit will honor the assignment of an issue to a milestone. If a mielstone does not exist in Bitbucket, it will be created. This ensure that when the new issue is created, its properly associated with the same milestones as it was in Github.
  30. ## Installation
  31. Install it via the gem command in terminal:
  32. $ gem install git2bit
  33. You can now execute it:
  34. $ git2bit --help
  35. ## Usage
  36. Here is an overview of the options available to git2bit along with some helpful examples. See below for how to set these values using a `.git2bit.rc` config file.
  37. Usage: git2bit [options]
  38. Options:
  39. -h, --help Show command line help
  40. --version Show help/version info
  41. --[no-]closed [Do not] migrate closed issues
  42. --issue ISSUE_NUMBER Process only a single Github issue number
  43. --guser USER Github username
  44. --gpass PASSWORD Github password
  45. --grepo REPO Github repo name
  46. --buser USER Bitbucket username
  47. --bpass PASSWORD Bitbucket password
  48. --brepo REPO Bitbucket repo name
  49. --log-level LEVEL Set the logging level
  50. (debug|info|warn|error|fatal)
  51. (Default: info)
  52. The following examples assume that you have the following options configured in your `.git2bit.rc` file: `guser`, `gpass`, `grepo`, `buser`, `bpass`, `brepo`
  53. Move *all* issues (open and closed):
  54. $ git2bit
  55. Move only *open* issues:
  56. $ git2bit --no-close
  57. Move a single issue:
  58. $ git2bit -i 532
  59. ### .git2bit.rc
  60. Instead of passing a ton of options via command line, you can setup the configuration values in a file named `.git2bit.rc`. This file should live in your home directory.
  61. Here is a sample file to get you going.
  62. guser: joeworkman
  63. gpass: p@ssw0rd
  64. grepo: myrepo
  65. buser: joeworkman
  66. bpass: p@ssw0rd
  67. brepo: newrepo
  68. ## Contributing
  69. 1. Fork it
  70. 2. Create your feature branch (`git checkout -b my-new-feature`)
  71. 3. Commit your changes (`git commit -am 'Add some feature'`)
  72. 4. Push to the branch (`git push origin my-new-feature`)
  73. 5. Create new Pull Request
  74. ## Thank You
  75. git2bit uses the following awesome Ruby Gems:
  76. * github_api - <https://github.com/peter-murach/github>
  77. * bitbucket_rest_api - <https://github.com/exceptionary/bitbucket>