jeffwidman / bitbucket-issue-migration

A small script for migrating repo issues from Bitbucket to GitHub
GNU General Public License v3.0
316 stars 95 forks source link

Use issue import API and other formatting improvements #25

Closed nicoddemus closed 8 years ago

nicoddemus commented 9 years ago

Hi,

Recently we migrated pytest from BitBucket and used your script, thanks for writing it and making it public!

I changed the requests to use the new import API because I was hitting the HTTP limit after migrating a few issues.

This PR includes a few other adjustments:

yohanboniface commented 9 years ago

Excellent :)

I used your fork to migrate uMap from bitbucket. As I pushed to an organization while using my personal account, I needed this diff to have auth happy:

diff --git a/migrate.py b/migrate.py
index 29fb699..c997c18 100644
--- a/migrate.py
+++ b/migrate.py
@@ -210,7 +210,7 @@ def get_issues(bb_url, start_id):
     issues = []

     while True:
-        url = "{}/?start={}".format(
+        url = "{}/?start={}&count=50&sort=title".format(
             bb_url,
             start_id
         )
@@ -330,7 +330,7 @@ if __name__ == "__main__":

     # push them in GitHub (issues comments are fetched here)
     gh_username, gh_repository = options.github_repo.split('/')
-    auth = (gh_username, github_password)
+    auth = (options.github_username, github_password)

     # Sort issues, to sync issue numbers on freshly created GitHub projects.
     # Note: not memory efficient, could use too much memory on large projects.

I also needed the sort + count change, otherwise only 180 of the 201 issues were migrated, dunno why. For the record, the command line I used:

python migrate.py yohanboniface umap yohanboniface umap-project/umap
nicoddemus commented 9 years ago

Cool, thanks for sharing! :smile:

jeffwidman commented 8 years ago

@vbabiy any reason this isn't merged?

jeffwidman commented 8 years ago

@vbabiy was nice enough to pass along the repo to me for continuing maintenance, so I've gone ahead and merged this--thanks again @nicoddemus (and a huge thank you from me for your work on pytest, I use it all the time.)

jeffwidman commented 8 years ago

I fixed the auth problem for pushing to a Github organization a little more cleanly in de04454b41acc5b38254b5a3dc08ed67be31ef59

Also I suspect/hope #30 will fix the issue with count/sort params being required in the BB url.

nicoddemus commented 8 years ago

@jeffwidman nice, thanks for taking over this repo!

and a huge thank you from me for your work on pytest, I use it all the time.

Cool, thanks for the support! :smile: