Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use issue import API and other formatting improvements #25

Merged
merged 8 commits into from
Dec 18, 2015

Conversation

nicoddemus
Copy link
Contributor

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:

  • Preserve the original date of creation for issues and comments (thanks to the new import API);
  • Fix an encoding issue when a comment contains non-ascii characters;
  • Change "Originally reported by" from footer to a header;
  • Remove references to Hg changesets from comment bodies;
  • Change explicit links in comments to relative links;
  • When mentioning an user, add a link to its GitHub's profile as well;
  • Add original kind and component as GitHub labels;

nicoddemus and others added 8 commits June 3, 2015 12:35
@yohanboniface
Copy link

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
Copy link
Contributor Author

Cool, thanks for sharing! 😄

yungyuc added a commit to yungyuc/bitbucket_issue_migration that referenced this pull request Nov 26, 2015
@jeffwidman
Copy link
Owner

@vbabiy any reason this isn't merged?

jeffwidman added a commit that referenced this pull request Dec 18, 2015
Use issue import API and other formatting improvements
@jeffwidman jeffwidman merged commit 48b2b1d into jeffwidman:master Dec 18, 2015
@jeffwidman
Copy link
Owner

@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 added a commit that referenced this pull request Dec 18, 2015
#25 switched from using pygithub3 to accessing Github's import API directly using the requests lib
@jeffwidman
Copy link
Owner

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

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

@nicoddemus
Copy link
Contributor Author

@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! 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants