bitbucket-issue-migration icon indicating copy to clipboard operation
bitbucket-issue-migration copied to clipboard

Support for attachments?

Open nedbat opened this issue 7 years ago • 12 comments

I haven't looked into this at all, but would it be possible to migrate attachments also?

nedbat avatar May 28 '18 11:05 nedbat

I don't think GitHub supports attachments.

IIRC, that was why iTerm uses GitLab for issue tracking, even though the project uses GitHub for code management.

Happy to re-open and explore this if I'm wrong...

jeffwidman avatar May 30 '18 21:05 jeffwidman

Hmmm, you can attach files in the UI (https://help.github.com/articles/file-attachments-on-issues-and-pull-requests/), but not in the API? Can that really be? :(

nedbat avatar May 31 '18 09:05 nedbat

square_dance

Is this an attachment?

nedbat avatar May 31 '18 10:05 nedbat

Indeed attachments are supported now. My bad, I should have googled. And that specific attachment is a visual trip. 😄

On the API side, I'm betting GitHub hasn't added it to their kinda-secret Bulk Import API which is what we use to avoid rate-limiting. But I'm not sure, so I've emailed their support and cc'd @nedbat.

jeffwidman avatar Jun 01 '18 05:06 jeffwidman

Answer from GitHub support (copy/pasted with their permission):

Hi there Jeff,

Thanks for getting in touch! It isn't currently possible to upload images through the GitHub API the same way you could drag-and-drop an image from your desktop to an Issue Comment box.

If you're interested in a workaround, you could use either the Repo Contents API (high-level API) or the Git Data API (low-level API) to commit images (or other content) to a Git repository:

https://developer.github.com/v3/repos/contents/#create-a-file

https://developer.github.com/v3/git/

Once the image is created, you can create an Issue using the Issues API and link to the images (or other content) you've committed to the repository or add a Markdown inline image link to the contents:

![image](URL_TO_IMAGE) Hope that helps! Feel free to let us know if you have any other questions.

jeffwidman avatar Jun 01 '18 21:06 jeffwidman

Hmmm, I played around with getting attachments. I figured I could at least add a link to the GitHub issue, that refers to the attachment on Bitbucket. But the Bitbucket api doesn't provide the URL to the attachment on the issue, and the URL doesn't seem easily constructable. I can get the content of the attachments, but I'm not sure where I would put them.

nedbat avatar Jun 16 '18 16:06 nedbat

Partially addressed by @nedbat in https://github.com/jeffwidman/bitbucket-issue-migration/pull/102/commits/b2dfda909f69dcd91354982cf62cc198d35be34c

Closing, as I think this is probably as good as we'll get with the current GitHub/Bitbucket APIs... very open to future improvements. And thanks again @nedbat for figuring out at least something here.

jeffwidman avatar Jun 25 '18 05:06 jeffwidman

I just tested this on a repo I have: https://bitbucket.org/thomthom/solid-inspector/src

For some issues the attachments appear to have transferred:

image

image

But for others it did not:

image

image

Any ideas why some work and some don't? Only thing I see is that the ones that work appear to have images embedded into the text. But the ones that doesn't the attachments are missing.

From the commit referenced above, it appear that "This issue had attachments:" should appear while processing attachments. No such message was seen in my console.

thomthom avatar Jul 09 '18 13:07 thomthom

paging @nedbat:

Any ideas why some work and some don't?

jeffwidman avatar Jul 10 '18 06:07 jeffwidman

@thomthom I think you see the difference ("images embedded into the text"). Markdown can have an image reference. In that case, the text is simply copied over to GitHub, which also renders the image. In this case, there is no attachment, just markup indicating an image.

Images which are attached are true attachments. How did you run the converter? Did you use --mention-attachments? If not, the attachments are ignored.

nedbat avatar Jul 10 '18 12:07 nedbat

Ah, I didn't use that flag. Didn't realize it was there. I was only referring to the list in the README in master.

I will give it another whirl.

thomthom avatar Jul 10 '18 12:07 thomthom

I ran it again, but it still didn't pick up my attachments.

λ python migrate.py thomthom/solid-inspector thomthom/solid-inspector thomthom --mention-attachments
Please enter your GitHub password.
Note: If your GitHub account has authentication enabled, you must use a personal access token from https://github.com/settings/tokens in place of a password for this script.

getting issues from bitbucket
done, loaded 46 issues
Imported Issue: https://api.github.com/repos/thomthom/solid-inspector/issues/1
Completed 1 of 46 issues
Imported Issue: https://api.github.com/repos/thomthom/solid-inspector/issues/2
Completed 2 of 46 issues
Imported Issue: https://api.github.com/repos/thomthom/solid-inspector/issues/3
Completed 3 of 46 issues
Imported Issue: https://api.github.com/repos/thomthom/solid-inspector/issues/4
Completed 4 of 46 issues
Imported Issue: https://api.github.com/repos/thomthom/solid-inspector/issues/5
Completed 5 of 46 issues
Imported Issue: https://api.github.com/repos/thomthom/solid-inspector/issues/6
Completed 6 of 46 issues
Imported Issue: https://api.github.com/repos/thomthom/solid-inspector/issues/7
Completed 7 of 46 issues
Imported Issue: https://api.github.com/repos/thomthom/solid-inspector/issues/8
Completed 8 of 46 issues
Imported Issue: https://api.github.com/repos/thomthom/solid-inspector/issues/9
Completed 9 of 46 issues
Imported Issue: https://api.github.com/repos/thomthom/solid-inspector/issues/10
Completed 10 of 46 issues
Imported Issue: https://api.github.com/repos/thomthom/solid-inspector/issues/11
Completed 11 of 46 issues
Imported Issue: https://api.github.com/repos/thomthom/solid-inspector/issues/12
Completed 12 of 46 issues
Imported Issue: https://api.github.com/repos/thomthom/solid-inspector/issues/13
Completed 13 of 46 issues
Imported Issue: https://api.github.com/repos/thomthom/solid-inspector/issues/14
Completed 14 of 46 issues
Imported Issue: https://api.github.com/repos/thomthom/solid-inspector/issues/15
Completed 15 of 46 issues
Imported Issue: https://api.github.com/repos/thomthom/solid-inspector/issues/16
Completed 16 of 46 issues
Imported Issue: https://api.github.com/repos/thomthom/solid-inspector/issues/17
Completed 17 of 46 issues
Imported Issue: https://api.github.com/repos/thomthom/solid-inspector/issues/18
Completed 18 of 46 issues
Imported Issue: https://api.github.com/repos/thomthom/solid-inspector/issues/19
Completed 19 of 46 issues
Imported Issue: https://api.github.com/repos/thomthom/solid-inspector/issues/20
Completed 20 of 46 issues
Imported Issue: https://api.github.com/repos/thomthom/solid-inspector/issues/21
Completed 21 of 46 issues
Imported Issue: https://api.github.com/repos/thomthom/solid-inspector/issues/22
Completed 22 of 46 issues
Imported Issue: https://api.github.com/repos/thomthom/solid-inspector/issues/23
Completed 23 of 46 issues
Imported Issue: https://api.github.com/repos/thomthom/solid-inspector/issues/24
Completed 24 of 46 issues
Imported Issue: https://api.github.com/repos/thomthom/solid-inspector/issues/25
Completed 25 of 46 issues
Imported Issue: https://api.github.com/repos/thomthom/solid-inspector/issues/26
Completed 26 of 46 issues
Imported Issue: https://api.github.com/repos/thomthom/solid-inspector/issues/27
Completed 27 of 46 issues
Imported Issue: https://api.github.com/repos/thomthom/solid-inspector/issues/28
Completed 28 of 46 issues
Imported Issue: https://api.github.com/repos/thomthom/solid-inspector/issues/29
Completed 29 of 46 issues
Imported Issue: https://api.github.com/repos/thomthom/solid-inspector/issues/30
Completed 30 of 46 issues
Imported Issue: https://api.github.com/repos/thomthom/solid-inspector/issues/31
Completed 31 of 46 issues
Imported Issue: https://api.github.com/repos/thomthom/solid-inspector/issues/32
Completed 32 of 46 issues
Imported Issue: https://api.github.com/repos/thomthom/solid-inspector/issues/33
Completed 33 of 46 issues
Imported Issue: https://api.github.com/repos/thomthom/solid-inspector/issues/34
Completed 34 of 46 issues
Imported Issue: https://api.github.com/repos/thomthom/solid-inspector/issues/35
Completed 35 of 46 issues
Imported Issue: https://api.github.com/repos/thomthom/solid-inspector/issues/36
Completed 36 of 46 issues
Imported Issue: https://api.github.com/repos/thomthom/solid-inspector/issues/37
Completed 37 of 46 issues
Imported Issue: https://api.github.com/repos/thomthom/solid-inspector/issues/38
Completed 38 of 46 issues
Imported Issue: https://api.github.com/repos/thomthom/solid-inspector/issues/39
Completed 39 of 46 issues
Imported Issue: https://api.github.com/repos/thomthom/solid-inspector/issues/40
Completed 40 of 46 issues
Imported Issue: https://api.github.com/repos/thomthom/solid-inspector/issues/41
Completed 41 of 46 issues
Imported Issue: https://api.github.com/repos/thomthom/solid-inspector/issues/42
Completed 42 of 46 issues
Imported Issue: https://api.github.com/repos/thomthom/solid-inspector/issues/43
Completed 43 of 46 issues
Imported Issue: https://api.github.com/repos/thomthom/solid-inspector/issues/44
Completed 44 of 46 issues
Imported Issue: https://api.github.com/repos/thomthom/solid-inspector/issues/45
Completed 45 of 46 issues
Imported Issue: https://api.github.com/repos/thomthom/solid-inspector/issues/46
Completed 46 of 46 issues

Example: https://bitbucket.org/thomthom/solid-inspector/issues/40 https://github.com/thomthom/solid-inspector/issues/40

Any ideas?

thomthom avatar Jul 10 '18 13:07 thomthom